public Models.PartyModel CreateParty(Models.PartyModel model) { using (var context = JavnaRasprava.WEB.DomainModels.ApplicationDbContext.Create()) { var party = new DomainModels.Party(); party.FullName = model.FullName; party.Name = model.Name; context.Parties.Add(party); context.SaveChanges(); return(GetPartyInternal(model.PartyID, context)); } }
public Models.PartyModel UpdateParty(Models.PartyModel model) { using (var context = JavnaRasprava.WEB.DomainModels.ApplicationDbContext.Create()) { var party = context.Parties .Where(x => x.PartyID == model.PartyID) .FirstOrDefault(); if (party == null) { return(null); } party.FullName = model.FullName; party.Name = model.Name; context.SaveChanges(); return(GetPartyInternal(model.PartyID, context)); } }