public IActionResult Patch(int id, [FromBody] ProductSizeDto productSizeDto) { var productSize = _mapper.Map <ProductSize>(productSizeDto); productSize.Id = id; var updatedProductSize = _productSizeService.Update(productSize); var updatedProductSizeDto = _mapper.Map <ProductSizeDto>(updatedProductSize); return(StatusCode((int)HttpStatusCode.Accepted, updatedProductSizeDto)); }
public ActionResult Edit(ProductSize pt) { if (ModelState.IsValid) { pt.ModifiedDate = DateTime.Now; pt.ModifiedBy = User.Identity.Name; pt.ObjectState = Model.ObjectState.Modified; _ProductSizeService.Update(pt); _unitOfWork.Save(); return(RedirectToAction("Index").Success("Data saved successfully")); } return(View(pt)); }
public ActionResult <ProductSize> Put(int id, [FromBody] ProductSize value) { try { if (id != value.Id) { return(Conflict("Parameter ID does not match ProductSize id")); } return(Ok(_productSizeService.Update(value))); } catch (Exception e) { return(BadRequest(e.Message)); } }