示例#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));
        }
示例#2
0
 public int UpdateWidgetConf(WidgetConfModel target, WidgetConfModel model)
 {
     _context.Entry(target).CurrentValues.SetValues(model);
     return(_context.SaveChanges());
 }
示例#3
0
 public int UpdateUser(UserUpdateModel updatedUser, UserModel target)
 {
     _context.Entry(target).CurrentValues.SetValues(updatedUser);
     return(_context.SaveChanges());
 }