Exemplo n.º 1
0
 public ActionResult Edit(SMS.Models.DON_VI_TINH donVi)
 {
     if (ModelState.IsValid)
     {
         var db        = new SmsContext();
         var donVitinh = db.DON_VI_TINH.Find((int)donVi.MA_DON_VI);
         donVitinh.TEN_DON_VI = donVi.TEN_DON_VI;
         donVitinh.GHI_CHU    = donVi.GHI_CHU;
         donVitinh.ACTIVE     = "A";
         donVitinh.UPDATE_AT  = DateTime.Now;
         donVitinh.UPDATE_BY  = (int)Session["UserId"];
         db.SaveChanges();
         return(RedirectToAction("Index").Success("Lưu thành công."));
     }
     return(View());
 }
Exemplo n.º 2
0
 public ActionResult AddNew(SMS.Models.DON_VI_TINH donVi)
 {
     Response.Cookies.Add(new HttpCookie("FlashMessage", "Data processed")
     {
         Path = "/"
     });
     if (ModelState.IsValid)
     {
         var db        = new SmsContext();
         var donVitinh = db.DON_VI_TINH.Create();
         donVitinh.TEN_DON_VI = donVi.TEN_DON_VI;
         donVitinh.GHI_CHU    = donVi.GHI_CHU;
         donVitinh.ACTIVE     = "A";
         donVitinh.UPDATE_AT  = DateTime.Now;
         donVitinh.CREATE_AT  = DateTime.Now;
         donVitinh.UPDATE_BY  = (int)Session["UserId"];
         donVitinh.CREATE_BY  = (int)Session["UserId"];
         db.DON_VI_TINH.Add(donVitinh);
         db.SaveChanges();
         return(RedirectToAction("Index").Success("Lưu thành công."));
     }
     return(View());
 }