public ActionResult AjaxTestUpdate(string row) { RawMaterial rawMaterial = JsonConvert.DeserializeObject <RawMaterial>(row); if (rawMaterial != null) { rawMaterial.LastModified = DateTime.Now; RawMaterialDto dto = new RawMaterialDto(); using (RawMaterialService service = new RawMaterialService()) { Mapper.Map(rawMaterial, dto); if (rawMaterial.Id > 0) { service.Update(dto); } else { dto.PlantId = CurrentPlantId; service.Add(dto); } } } return(RedirectToAction("Index")); }
public JsonResult AjaxRawMaterialUpdate(string row) { TPO.Web.Core.ResponseMessage responseMessage; RawMaterial rawMaterial = JsonConvert.DeserializeObject <RawMaterial>(row); try { if (rawMaterial != null) { rawMaterial.LastModified = DateTime.Now; RawMaterialDto dto = new RawMaterialDto(); using (RawMaterialService service = new RawMaterialService()) { Mapper.Map(rawMaterial, dto); if (rawMaterial.Id > 0) { service.Update(dto); } else { dto.PlantId = CurrentPlantId; service.Add(dto); } } } responseMessage = SetResponseMesssage(ActionTypeMessage.SuccessfulSave); } catch (Exception exc) { responseMessage = SetResponseMesssage(ActionTypeMessage.FailedSave, exc.Message); } return(Json(responseMessage, JsonRequestBehavior.AllowGet)); }