public HttpResponseMessage Put([FromBody] HouseDto houseDto) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Missing values")); } string result = _houseService.Edit(houseDto); return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public async Task <IActionResult> Edit(HouseForEditDto house) { var result = await _houseService.Edit(house); if (result) { return(Ok("Edit successful")); } else { return(BadRequest("Failed to Edit")); } }
public IActionResult Edit(HouseEditViewModel houseVM) { if (houseVM == null) { return(NotFound()); } houseVM.House.CategoryId = houseVM.CategoryId; houseVM.House.OwnerId = houseVM.OwnerId; if (ModelState.IsValid) { var house = houseVM.House; _houseService.Edit(house); TempData.Add("ResultMessage", "House Edited Successfully!"); return(RedirectToAction("Details", new { id = house.HouseId })); } houseVM.Owners = GetOwnersList(); return(View(houseVM)); }