c# - Edit two models -
in event controllers edit parameter of event model on user model.
the value in controllers corrects. value of event model save
in event model have among other things :
public guid? userid { get; set; } public virtual user user_ss { get; set; } [httppost] [validateantiforgerytoken] public actionresult achat( event @event) { if (modelstate.isvalid) { db.entry(@event).state = entitystate.unchanged; @event.nbpartid = @event.nbpartid - @event.nbformid; var c = (@event.budget * (@event.nbformid)); var userprofiluser = (from s in db.users s.personemail.contains(user.identity.name) select s).tolist(); db.entry(db.users.find(userprofiluser[0].userid)).state = entitystate.unchanged; var p = (userprofiluser[0].wallet) - c; db.entry(db.users.find(userprofiluser[0].userid)).state = entitystate.modified; db.entry(@event).state = entitystate.modified; db.savechanges();
Comments
Post a Comment