Beispiel #1
0
        public ActionResult Edit(Advertise collection)
        {
            AdvertiseDao bdDao = new AdvertiseDao();

            try
            {
                UserLogin us = (UserLogin)Session[SystemConsts.USER_SESSION];

                collection.ModifiedBy   = us.UserName;
                collection.ModifiedDate = Hepper.GetDateServer();


                if (bdDao.Update(collection))
                {
                    SetAlert(@Resources.ResourceAdmin.AdminEditRecordSucess, "success");
                    return(RedirectToAction("Index"));
                }
                else
                {
                    SetAlert(@Resources.ResourceAdmin.AdminEditRecordFailed, "danger");
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                SetAlert(@Resources.ResourceAdmin.AdminEditRecordFailed, "danger");
                return(View());
            }
        }
Beispiel #2
0
        public ActionResult Create(Advertise collection)
        {
            try
            {
                AdvertiseDao bdDao = new AdvertiseDao();

                UserLogin us = (UserLogin)Session[SystemConsts.USER_SESSION];
                collection.CreateBy     = us.UserName;
                collection.CreateDate   = Hepper.GetDateServer();
                collection.ModifiedBy   = us.UserName;
                collection.ModifiedDate = Hepper.GetDateServer();
                collection.LanguageID   = "vi";
                //collection.CreateBy = us.UserName;
                //collection.ModifiedBy = us.UserName;
                if (bdDao.Insert(collection))
                {
                    SetAlert(@Resources.ResourceAdmin.AdminCreateRecordSuccess, "success");
                    return(RedirectToAction("Index"));
                }
                else
                {
                    SetAlert(@Resources.ResourceAdmin.AdminCreateRecordFailed, "danger");
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                SetAlert(@Resources.ResourceAdmin.AdminCreateRecordFailed, "danger");
                return(View());
            }
        }
Beispiel #3
0
        public ActionResult Delete(long id)
        {
            try
            {
                // TODO: Add delete logic here

                AdvertiseDao bdDao = new AdvertiseDao();

                bdDao.Delete(id);
                // SetAlert("Xóa thành công", "success");
                return(RedirectToAction("Index"));
            }
            catch
            {
                // SetAlert("Không xóa được", "danger");
                return(View());
            }
        }
Beispiel #4
0
        // GET: Admin/Advertise/Edit/5
        public ActionResult Edit(long id)
        {
            AdvertiseDao db = new AdvertiseDao();

            return(View(db.FindByID(id)));
        }
Beispiel #5
0
        // GET: Admin/Advertise
        public ActionResult Index()
        {
            AdvertiseDao db = new AdvertiseDao();

            return(View(db.ToList()));
        }
Beispiel #6
0
 public AdvertiseService()
 {
     dao = new AdvertiseDao();
 }