Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            PageGroup pageGroup = pg.GetPageGroupById(id);

            if (!pa.GetPageByGroupId(id).Any())
            {
                if (Directory.Exists(Server.MapPath("/Images/Pages/" + pg.GetPageGroupById(id).GroupTitle)))
                {
                    Directory.Delete(Server.MapPath("/Images/Pages/" + pg.GetPageGroupById(id).GroupTitle));
                }

                pg.DeletePageGroup(id);
                pg.SavePageGroup();
                return(RedirectToAction("Index"));
            }
            else
            {
                this.ModelState.AddModelError("", "امکان حذف گروه خبری " + pg.GetPageGroupById(id).GroupTitle + " وجود ندارد.");
            }
            return(PartialView(pageGroup));
        }
Пример #2
0
 public ActionResult DeleteConfirmed(int id)
 {
     pageGroupRepository.DeletePageGroup(id);
     pageGroupRepository.Save();
     return(RedirectToAction("Index"));
 }