Ejemplo n.º 1
0
        public ActionResult EditQuyCach(QuyCach model)
        {
            ThongBaoMvc thongbao;

            db.Entry(model).State = EntityState.Modified;
            try {
                db.SaveChanges();
                thongbao = new ThongBaoMvc {
                    CssClassName = "success", Message = "Thay đổi thông tin thành công"
                };
                TempData["ResultAction"] = thongbao;
            }
            catch (Exception e)
            {
                log.Error("Lỗi thay đổi quy cách: " + e.Message);
                thongbao = new ThongBaoMvc {
                    CssClassName = "danger", Message = "Lỗi"
                };
                TempData["ResultAction"] = thongbao;
            }
            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult CreateQuyCach(QuyCach model)
        {
            ThongBaoMvc thongbao;

            model.MaCN = kiemtra.getUser(User.Identity.Name).MaCN;
            db.QuyCachs.Add(model);
            try {
                db.SaveChanges();
                thongbao = new ThongBaoMvc {
                    CssClassName = "success", Message = "Thêm đơn vị đo mới thành công"
                };
                TempData["ResultAction"] = thongbao;
            }
            catch (Exception e)
            {
                thongbao = new ThongBaoMvc {
                    CssClassName = "danger", Message = "Lỗi"
                };
                TempData["ResultAction"] = thongbao;
                log.Error("Lỗi khi thêm quy cách mới: " + e.Message);
            }
            return(RedirectToAction("QuyCach"));
        }