public JsonResult SaveNew(ProdMgrDTO dto) { bool succeeded = false; try { var model = new tbl_prodmgr(); model.prodmgr_Fname = dto.prodmgr_Fname; model.prodmgr_Lname = dto.prodmgr_Lname; UnitOfWork.TblProdMgr.Add(model); UnitOfWork.Save(); dto.id = model.id; } catch (Exception ex) { dto.id = 0; } return(Json(dto, JsonRequestBehavior.AllowGet)); }
public JsonResult Update(ProdMgrDTO dto) { bool succeeded = false; try { var model = UnitOfWork.TblProdMgr.Get(dto.id); if (model != null) { model.prodmgr_Fname = dto.prodmgr_Fname; model.prodmgr_Lname = dto.prodmgr_Lname; UnitOfWork.Save(); succeeded = true; } } catch (Exception ex) { succeeded = false; } return(Json(succeeded, JsonRequestBehavior.AllowGet)); }