示例#1
0
        public ActionResult AddNew(PopUpBannerKMModel model)
        {
            DateTime start = DateTimeHelper.ConvertToLongDay(model.StartDay);
            DateTime end   = DateTimeHelper.ConvertToLongDay(model.EndDay);

            if (ModelState.IsValid)
            {
                PopUpBannerKM menu = new PopUpBannerKM()
                {
                    HinhAnh  = (model.HinhAnh).Replace("/files/", ""),
                    TieuDe   = model.TieuDe,
                    Created  = DateTime.Now,
                    Link     = model.Link,
                    EndDay   = end,
                    Active   = true,
                    StartDay = start
                };
                _popUpBannerKmRepository.Add(menu);
                _unitOfWork.Commit();
            }
            else
            {
                return(View("Create", model));
            }
            return(RedirectToAction("Index"));
        }
示例#2
0
        public ActionResult SaveEdit(PopUpBannerKMModel model)
        {
            DateTime      start = DateTimeHelper.ConvertToLongDay(model.StartDay);
            DateTime      end   = DateTimeHelper.ConvertToLongDay(model.EndDay);
            PopUpBannerKM dlcu  = _popUpBannerKmRepository.GetById(model.Id);

            dlcu.Id       = model.Id;
            dlcu.TieuDe   = model.TieuDe;
            dlcu.Created  = DateTime.Now;
            dlcu.Link     = model.Link;
            dlcu.StartDay = start;
            dlcu.EndDay   = end;
            dlcu.HinhAnh  = (model.HinhAnh).Replace("/files/", "");
            _popUpBannerKmRepository.Update(dlcu);
            _unitOfWork.Commit();
            return(RedirectToAction("Index"));
        }
示例#3
0
        public ActionResult Index()
        {
            PopUpBannerKM bannerQCtrangchu = _popUpBannerKmRepository.GetAll().FirstOrDefault();

            return(View("Index", bannerQCtrangchu));
        }