Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        public bool updateHolidayhomeDb(Holidayhome hse)
        {
            db.Entry(hse).State = EntityState.Modified;

            db.SaveChanges();
            return(true);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
 public ActionResult Edit(Holidayhome holidayhome)
 {
     if (ModelState.IsValid)
     {
         db.Entry(holidayhome).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(holidayhome));
 }
Exemplo n.º 6
0
 public ActionResult Edit(Owner owner)
 {
     if (ModelState.IsValid)
     {
         db.Entry(owner).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(owner));
 }
Exemplo n.º 7
0
 public bool updateHolidayhomeDb(Holidayhome hse)
 {
     db.Entry(hse).State = EntityState.Modified;
     try
     {
         db.SaveChanges();
         return(true);
     }
     catch (Exception exp)
     {
         // do something
         return(false);
     }
 }
Exemplo n.º 8
0
 public void UpdateHolidayhome(Holidayhome Holidayhome)
 {
     context.Entry(Holidayhome).State = EntityState.Modified;
 }
Exemplo n.º 9
0
 public bool updateBookingDb(Booking bok)
 {
     db.Entry(bok).State = EntityState.Modified;
     db.SaveChanges();
     return(true);
 }
Exemplo n.º 10
0
 public void UpdateOwner(Owner Owner)
 {
     context.Entry(Owner).State = EntityState.Modified;
 }
Exemplo n.º 11
0
 public bool updateOwnerDb(Owner own)
 {
     db.Entry(own).State = EntityState.Modified;
     db.SaveChanges();
     return(true);
 }
Exemplo n.º 12
0
 public void Update(RoomInfo room)
 {
     _context.Entry(room).State = EntityState.Modified;
 }