Exemplo n.º 1
0
        public ActionResult _Form(int?Id
                                  , string TenTheLoai
                                  , string TieuDe
                                  , string MoTa
                                  )
        {
            var            session = (UserLogin)Session[CommonConstants.USER_SESSION];
            TheLoaiService _tl     = new TheLoaiService();

            Models.TheLoai tl = _tl.FindByKeys(Id);
            tl.TenTheLoai = TenTheLoai;
            tl.TieuDe     = TieuDe;
            tl.MoTa       = MoTa;
            if (Id.HasValue)
            {
                tl.NguoiSua = session.Name;
                tl.NgaySua  = DateTime.Now;
                _tl.Update(tl);
                setAlert("Thông tin sản phẩm đã được cập nhập", "success");
            }
            else
            {
                tl.NgayTao = DateTime.Now;
                _tl.Insert(tl);
                setAlert("Thêm sản phẩm thành công", "success");
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public PartialViewResult _Form(int?Id)
        {
            var tl = new Models.TheLoai();

            if (Id.HasValue && Id != null)
            {
                var theloai = new TheLoaiService();
                tl = theloai.FindByKeys(Id);
            }
            return(PartialView(tl));
        }