public bool Save(CheckModel model) { try { tbl_List_Check tbl = new tbl_List_Check(); tbl.RequestId = model.RequestId; tbl.Ma_NCC = model.Ma_NCC; tbl.Ma_TB = model.Ma_TB; tbl.YC_KT = model.YC_KT; tbl.TT_KT = model.TT_KT; tbl.YC_SL = model.YC_SL; tbl.TT_SL = model.TT_SL; tbl.DonVi = model.DonVi; tbl.User_Nhap = model.User_Nhap; tbl.Date_Nhap = DateTime.Now; db.tbl_List_Check.Add(tbl); db.SaveChanges(); return(true); } catch { return(false); } }
public bool Update(CheckModel model) { try { tbl_List_Check tbl = new tbl_List_Check(); tbl = db.tbl_List_Check.Find(model.Id); tbl.Ma_NCC = model.Ma_NCC; tbl.Ma_TB = model.Ma_TB; tbl.YC_KT = model.YC_KT; tbl.TT_KT = model.TT_KT; tbl.YC_SL = model.YC_SL; tbl.TT_SL = model.TT_SL; tbl.DonVi = model.DonVi; tbl.User_Edit = model.User_Nhap; tbl.Date_Edit = DateTime.Now; db.SaveChanges(); return(true); } catch { return(false); } }
public ActionResult SaveCheck(SaveApprovalModel model) { try { EFDbContext db = new EFDbContext(); tbl_List_Check tbl = new tbl_List_Check(); tbl = db.tbl_List_Check.Find(model.Id); tbl.CO = model.CO; tbl.CQ = model.CQ; tbl.MTR = model.MTR; tbl.SN = model.SN; tbl.PN = model.PN; tbl.Other = model.Other; tbl.Note_Other = model.Other.ToString() == "true"?model.Note_Other:null; tbl.Result = model.Result; tbl.Reason = model.Reason; db.SaveChanges(); return(Json(new { status = true }, JsonRequestBehavior.AllowGet)); } catch { return(Json(new { status = false }, JsonRequestBehavior.AllowGet)); } }