public IHttpActionResult Put(HouseUpdate model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var service = CreateHouseService();

            if (!service.UpdateHouse(model))
            {
                return(InternalServerError());
            }
            return(Ok());
        }
Esempio n. 2
0
 public bool UpdateHouse(HouseUpdate model)
 {
     using (var ctx = new ApplicationDbContext())
     {
         var entity =
             ctx
             .Houses
             .Single(e => e.Id == model.Id);
         entity.Name   = model.Name;
         entity.Sigil  = model.Sigil;
         entity.Words  = model.Words;
         entity.Region = model.Region;
         return(ctx.SaveChanges() == 1);
     }
 }
 public void Put(int id, [FromBody] HouseUpdate house)
 {
     //Update House
 }