示例#1
0
        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));
            }
        }
示例#2
0
        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));
            }
        }