public void Update(Advert advert) { var adTemp = _advertContext.Adverts.SingleOrDefault(ad => ad.Id == advert.Id); if (adTemp != null) { _advertContext.Entry(advert).State = EntityState.Detached; _advertContext.Adverts.Attach(advert); _advertContext.Entry(advert).State = EntityState.Modified; _advertContext.SaveChanges(); } }
public ActionResult <UserModel> Update(User user) { var userTemp = _userContext.Users.SingleOrDefault(userP => userP.Id == user.Id); if (userTemp != null) { user.Password = userTemp.Password; _userContext.Entry(userTemp).State = EntityState.Detached; _userContext.Users.Attach(user); _userContext.Entry(user).State = EntityState.Modified; _userContext.SaveChanges(); } return(Map(user)); }
public bool updateHolidayhomeDb(Holidayhome hse) { db.Entry(hse).State = EntityState.Modified; db.SaveChanges(); return(true); }
public async Task <Owner> GetByIdAsync(string Id) { if (string.IsNullOrEmpty(Id)) { throw new ArgumentNullException(); } var owner = await _context.Owners.FindAsync(Id); // .Where(x => x.Id == Id) // .Include(x => x.Properties) // .ThenInclude(x => x.PhysicalBlock) // .FirstOrDefaultAsync(); await _context.Entry(owner).Collection(x => x.Properties).LoadAsync(); return(owner); }
public ActionResult Edit(Holidayhome holidayhome) { if (ModelState.IsValid) { db.Entry(holidayhome).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(holidayhome)); }
public ActionResult Edit(Owner owner) { if (ModelState.IsValid) { db.Entry(owner).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(owner)); }
public bool updateHolidayhomeDb(Holidayhome hse) { db.Entry(hse).State = EntityState.Modified; try { db.SaveChanges(); return(true); } catch (Exception exp) { // do something return(false); } }
public void UpdateHolidayhome(Holidayhome Holidayhome) { context.Entry(Holidayhome).State = EntityState.Modified; }
public bool updateBookingDb(Booking bok) { db.Entry(bok).State = EntityState.Modified; db.SaveChanges(); return(true); }
public void UpdateOwner(Owner Owner) { context.Entry(Owner).State = EntityState.Modified; }
public bool updateOwnerDb(Owner own) { db.Entry(own).State = EntityState.Modified; db.SaveChanges(); return(true); }
public void Update(RoomInfo room) { _context.Entry(room).State = EntityState.Modified; }