public bool EditBuyProperty(BuyEdit model) { using (var db = new ApplicationDbContext()) { var entity = db.RealEstateBuy.Single(s => s.BuyId == model.BuyId); entity.RealEstatePropertyId = model.RealEstatePropertyId; entity.BuyId = model.BuyId; entity.DateAvail = model.DateAvail; entity.Price = model.Price; entity.Description = model.Description; return(db.SaveChanges() == 1); } }
public IHttpActionResult Put(BuyEdit editBuyProperty) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreateBuyPropertyService(); if (!service.EditBuyProperty(editBuyProperty)) { return(InternalServerError()); } return(Ok()); }