Пример #1
0
 public PartModel UpdatePart(PartModel part)
 {
     _db.Parts.Attach(part);
     _db.Entry(part).State = EntityState.Modified;
     _db.SaveChanges();
     return(part);
 }
Пример #2
0
 public ActivityModel UpdateActivity(ActivityModel model)
 {
     _context.Activities.Attach(model);
     _context.Entry(model).State = EntityState.Modified;
     _context.SaveChanges();
     return(model);
 }
Пример #3
0
 public ComputerModel UpdateComputer(ComputerModel model)
 {
     _context.Computers.Attach(model);
     _context.Entry(model).State = EntityState.Modified;
     _context.SaveChanges();
     return(model);
 }
Пример #4
0
 public void SaveAnnouncement(AnnouncementModel model)
 {
     if (model != null)
     {
         if (model.Id == 0) //Id = 0 then this is a new announcement, otherwise it's existing
         {
             _context.Announcements.Add(model);
         }
         else
         {
             _context.Announcements.Attach(model);
             _context.Entry(model).State = EntityState.Modified;
         }
         _context.SaveChanges();
     }
 }
Пример #5
0
 public void UpdateMember(MemberModel member)
 {
     _context.Members.Attach(member);
     _context.Entry(member).State = EntityState.Modified;
     _context.SaveChanges();
 }