Esempio n. 1
0
        public IHttpActionResult PutArea(int id, Area area)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != area.Id)
            {
                return(BadRequest());
            }

            db.Entry(area).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AreaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 2
0
 public int UpdateWidgetConf(WidgetConfModel target, WidgetConfModel model)
 {
     _context.Entry(target).CurrentValues.SetValues(model);
     return(_context.SaveChanges());
 }
Esempio n. 3
0
 public int UpdateUser(UserUpdateModel updatedUser, UserModel target)
 {
     _context.Entry(target).CurrentValues.SetValues(updatedUser);
     return(_context.SaveChanges());
 }