public ActionResult Create(Footer entity)
        {
            if (ModelState.IsValid)
            {
                long id;

                try
                {
                    entity.CreatedOn = DateTime.Now;
                    entity.Status    = true;
                    id = new FooterDao().Insert(entity);
                }
                catch (Exception ex)
                {
                    return(View("Error", new HandleErrorInfo(ex, "Footer", "Index")));
                }
                if (id > 0)
                {
                    ModelState.AddModelError("", "Thêm mới thành công");
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Thêm mới không thành công");
                    return(RedirectToAction("Index"));
                }
            }
            else
            {
                ModelState.AddModelError("", "Vui lòng nhập đầy đủ thông tin");
                return(View());
            }
        }
        public ActionResult Edit(Footer collection)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    // TODO: Add insert logic here

                    FooterDao bdDao = new FooterDao();
                    UserLogin us    = (UserLogin)Session[SystemConsts.USER_SESSION];


                    if (bdDao.Update(collection))
                    {
                        SetAlert("Thêm thành công", "success");
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        SetAlert("Không thêm được", "danger");
                    }
                }
                return(View());
            }
            catch
            {
                SetAlert("Không thêm được", "danger");
                return(View());
            }
        }
Exemple #3
0
        public ActionResult Edit(string id)
        {
            var dao     = new FooterDao();
            var product = dao.GetById(id);

            return(View(product));
        }
        public ActionResult Footer()

        {
            var model = new FooterDao().GetFooter();

            return(PartialView(model));
        }
        public ActionResult Edit(long id)
        {
            var dao    = new FooterDao();
            var footer = dao.GetByID(id);

            return(View());
        }
        public ActionResult Index()
        {
            var dao   = new FooterDao();
            var model = dao.ListFooter();

            return(View(model));
        }
        public ActionResult Footer2()
        {
            var dao   = new FooterDao();
            var model = dao.GetFooter("2");

            return(PartialView(model));
        }
        public ActionResult Footer()
        {
            var lang  = HttpContext.Session["CurrentCulture"].ToString();
            var model = new FooterDao().GetFooter(lang);

            return(PartialView(model));
        }
Exemple #9
0
        public ActionResult Footer()
        {
            var footerDao = new FooterDao();
            var footer    = footerDao.GetFooter();

            return(PartialView(footer));
        }
Exemple #10
0
 public JsonResult ChangeStatus(int id)
 {
     var res = new FooterDao().ChangeStatus(id);
     return Json(new
     {
         status = res
     });
 }
 public ActionResult Edit(Footer footer)
 {
     if (ModelState.IsValid)
     {
         long id = new FooterDao().update(footer);
     }
     return(RedirectToAction("Index"));
 }
Exemple #12
0
        // GET: Admin/Footer
        public ActionResult Index(string searchString, int page = 1, int pageSize = 5)
        {
            var dao   = new FooterDao();
            var model = dao.ListAllPaging(searchString, page, pageSize);

            ViewBag.SearchString = searchString;
            return(View(model));
        }
Exemple #13
0
        public PartialViewResult FooterPartial()

        {
            FooterDao dbCat = new FooterDao();
            AboutDao  abDao = new AboutDao();

            ViewBag.About = abDao.ToActive();
            return(PartialView(dbCat.ToActive()));
        }
Exemple #14
0
        public JsonResult ChangeStatus(long id)
        {
            var result = new FooterDao().ChangeStatus(id);

            return(Json(new
            {
                status = result
            }));
        }
Exemple #15
0
        public JsonResult ChangeStatus(string id)
        {
            if (String.IsNullOrEmpty(id))
            {
                return(Json(new { status = false, mess = "False" }));
            }
            var result = new FooterDao().ChangeStatus(id);

            return(Json(new { status = result, mess = "Thay đổi thành công" }));
        }
Exemple #16
0
 public ActionResult Footer()
 {
     try
     {
         var model = new FooterDao().GetFooter();
         return(PartialView(model));
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Exemple #17
0
 public ActionResult Edit(Footer footer)
 {
     var res = new FooterDao().Update(footer);
     if (res)
     {
         ViewBag.Info = "Cập nhật thành công!";
     }
     else
     {
         ViewBag.Info = "Cập nhật không thành công!";
     }
     return View();
 }
Exemple #18
0
 public ActionResult Create(Footer footer)
 {
     var res = new FooterDao().Insert(footer);
     if (res)
     {
         ViewBag.Info = "Thêm mới thành công";
     }
     else
     {
         ViewBag.Info = "Thêm mới không thành công";
     }
     return View(footer);
 }
Exemple #19
0
        public JsonResult Delete(string id)
        {
            if (String.IsNullOrEmpty(id))
            {
                return(Json(new { status = false, mess = "False" }));
            }
            var data = new FooterDao().ViewByID(id);

            if (data.Status.Value)
            {
                return(Json(new { status = false, mess = "Không xóa được" }));
            }
            new FooterDao().Delete(id);
            return(Json(new { status = true, mess = "Xóa thành công" }));
        }
        public ActionResult Delete(int id)
        {
            bool result = new FooterDao().Delete(id);

            if (result)
            {
                ModelState.AddModelError("", "Xóa thành công");
                return(RedirectToAction("Index"));
            }
            else
            {
                ModelState.AddModelError("", "Xóa không thành công");
                return(RedirectToAction("Index"));
            }
        }
Exemple #21
0
        public ActionResult Create(Footer footer)
        {
            if (ModelState.IsValid)
            {
                var    dao = new FooterDao();
                string id  = dao.Insert(footer);
                return(RedirectToAction("Index", "Footer"));
            }
            else
            {
                ModelState.AddModelError("", "Không thêm được");
            }


            return(View("Index"));
        }
Exemple #22
0
 public ActionResult Create(Footer footer) // Tạo tài khoản
 {
     if (ModelState.IsValid)
     {
         var  dao = new FooterDao();
         long id  = dao.Insert(footer);
         if (id > 0)
         {
             return(RedirectToAction("Index", "Footer"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm không thành công");
         }
     }
     return(View("Index"));
 }
Exemple #23
0
 public ActionResult Edit(Footer footer)
 {
     if (ModelState.IsValid)
     {
         var dao    = new FooterDao();
         var result = dao.Update(footer);
         if (result)
         {
             return(RedirectToAction("Index", "Footer"));
         }
         else
         {
             ModelState.AddModelError("", "Không thêm được");
         }
     }
     return(View("Index"));
 }
        public ActionResult Delete(string id)
        {
            try
            {
                // TODO: Add delete logic here

                FooterDao bdDao = new FooterDao();
                MenuDao   mnDao = new MenuDao();

                bdDao.Delete(id);
                // SetAlert("Xóa thành công", "success");
                return(RedirectToAction("Index"));
            }
            catch
            {
                // SetAlert("Không xóa được", "danger");
                return(View());
            }
        }
Exemple #25
0
        public ActionResult Edit(Footer model)
        {
            if (ModelState.IsValid)
            {
                var dao = new FooterDao();

                var result = dao.Update(model);
                if (result)
                {
                    SetAlert("Update content thành công", "success");
                    return(RedirectToAction("Index", "Footer"));
                }
                else
                {
                    ModelState.AddModelError("", "Cập nhật content không thành công");
                }
            }
            return(View());
        }
Exemple #26
0
        public JsonResult Delete(int id)
        {
            var res = new FooterDao().Delete(id);
            if (res)
            {
                return Json(new
                {
                    status = true
                }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                return Json(new
                {
                    status = false
                }, JsonRequestBehavior.AllowGet);
            }

        }
Exemple #27
0
 public ActionResult Create(Footer model)
 {
     if (ModelState.IsValid)
     {
         var    dao = new FooterDao();
         string id  = dao.Insert(model);
         if (id != null)
         {
             SetAlert("Thêm thông tin thành công", "success");
             return(RedirectToAction("Index", "Footer"));
         }
         else
         {
             SetAlert("Thêm user không thành công", "error");
             ModelState.AddModelError("", "Thêm thông tin không thành công");
         }
     }
     return(View());
 }
        public ActionResult Update(Footer entity)
        {
            bool result;

            try
            {
                result = new FooterDao().Update(entity);
            }
            catch (Exception ex)
            {
                return(View("Eror", new HandleErrorInfo(ex, "Category", "Index")));
            }
            if (result)
            {
                ModelState.AddModelError("", "Cập nhật thành công");
                return(RedirectToAction("Index"));
            }
            else
            {
                ModelState.AddModelError("", "Cập nhật không thành công");
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult Create([Bind(Include = "ID,Name,Link,DisplayOrder,ParentID,Status")] Footer footer)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var dao = new FooterDao();

                    footer.Name         = footer.Name;
                    footer.Link         = footer.Link;
                    footer.DisplayOrder = footer.DisplayOrder;
                    footer.ParentID     = footer.ParentID;
                    footer.Status       = Convert.ToBoolean(true);
                    var id = dao.Insert(footer);
                    if (id > 0)
                    {
                        SetAlert("Thêm mới thành thành công", "success");
                        ViewBag.Success = "Thêm thành công";
                        footer          = new Footer();
                        return(RedirectToAction("Index", "Footer"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Thêm mới ko thành công");
                    }
                }
            }
            catch (DbEntityValidationException e)
            {
                throw e;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(View(footer));
        }
 public ActionResult Edit([Bind(Include = "ID,Name,Link,DisplayOrder,Status")] Footer footer)
 {
     if (ModelState.IsValid)
     {
         var dao = new FooterDao();
         footer.Name         = footer.Name;
         footer.Link         = footer.Link;
         footer.DisplayOrder = footer.DisplayOrder;
         footer.Status       = Convert.ToBoolean(true);
         var result = dao.Update(footer);
         if (result)
         {
             SetAlert("Cập nhật thành công", "success");
             ViewBag.Success = "Thêm thành công";
             footer          = new Footer();
             return(RedirectToAction("Index", "Footer"));
         }
         else
         {
             ModelState.AddModelError("", "Cập nhật ko thành công");
         }
     }
     return(View(footer));
 }
 public ActionResult Footer()
 {
     var model = new FooterDao().GetFooter();
     return PartialView(model);
 }