public JsonResult GetWIPStoreById(int Id) { WIPStoreViewModel model = new WIPStoreViewModel(); Data.Models.WIPStore objData = this._wipStoreService.GetWIPById(Id); if (objData != null) { model.Id = objData.Id; model.Name = objData.Name; model.Location = objData.Location; model.Description = objData.Description; } return(Json(model, JsonRequestBehavior.AllowGet)); }
public JsonNetResult SaveWIPStore(Data.Models.WIPStore wipData) { JsonResponse response = null; try { response = new JsonResponse(); wipData.CreateBy = HttpContext.User.Identity.GetUserId <int>(); wipData.UpdateBy = HttpContext.User.Identity.GetUserId <int>(); wipData.CreateOn = DateTime.Now; this._wipStoreService.SaveWIPStore(wipData); response.Status = JsonResponseStatus.Success; response.Message = "WIP Store saved"; } catch (Exception ex) { response.Status = JsonResponseStatus.Error; response.Message = ProcessException(ex); } return(JsonNet(response, JsonRequestBehavior.AllowGet)); }
public int SaveWIPStore(Data.Models.WIPStore wipData) { if (wipData != null) { if (wipData.Id > 0) { var existingData = this._wipStoreRepository.Table.FirstOrDefault(w => w.Id == wipData.Id); existingData.Name = wipData.Name; existingData.Location = wipData.Location; existingData.Description = wipData.Description; existingData.UpdateOn = DateTime.Now; existingData.UpdateBy = wipData.UpdateBy; this._wipStoreRepository.Update(existingData); } else { this._wipStoreRepository.Insert(wipData); } return(1); } return(0); }