Exemplo n.º 1
0
        // GET: /<controller>/
        public ActionResult Index(Guid?id = null)
        {
            ViewData["Id"] = id.ToString();
            var items = new DbController.Model_Group().Select().Where(x => x.OtherProps.ParentId == id).Select(x => new v_Group {
                AdminUsername = x.OtherProps.AdminUsername, Id = x.OtherProps.Id, Name = x.OtherProps.Name, ParentId = x.OtherProps.ParentId, Posts = x.OtherProps.Posts, Publish = x.OtherProps.Publish, Serial = x.OtherProps.Serial, SubGroups = x.OtherProps.SubGroups
            });

            try
            {
                ViewBag.Title = new DbController.Model_Group().Select().Where(y => y.OtherProps.Id == id).Select(x => new { Title = x.OtherProps.Name }).FirstOrDefault().Title;
            }
            catch
            {
                ViewBag.Title = "منو";
            }
            try
            {
                ViewData["ParentId"] = new DbController.Model_Group().Select().Where(y => y.OtherProps.Id == id).Select(x => new { ParentId = x.OtherProps.ParentId }).FirstOrDefault().ParentId;
            }
            catch
            {
            }
            ViewData["newParentId"] = id;
            return(View(items));
        }
Exemplo n.º 2
0
        public ActionResult Update(Guid Id)
        {
            v_Group group = new DbController.Model_Group().Select().Where(x => x.OtherProps.Id == Id).Select(x => new v_Group {
                AdminUsername = x.OtherProps.AdminUsername, Id = x.OtherProps.Id, Name = x.OtherProps.Name, ParentId = x.OtherProps.ParentId, Posts = x.OtherProps.Posts, Publish = x.OtherProps.Publish, Serial = x.OtherProps.Serial, SubGroups = x.OtherProps.SubGroups
            }).FirstOrDefault();

            return(View(group));
        }
Exemplo n.º 3
0
        public ActionResult Delete(Guid?Id = null)
        {
            v_Group group = new DbController.Model_Group().Select().Where(x => x.OtherProps.Id == Id).Select(y => new v_Group {
                Name = y.OtherProps.Name, Id = y.OtherProps.Id
            }).FirstOrDefault();

            ViewData["Message"] = "آیا از حذف این گروه اطمینان دارید؟";
            return(View(group));
        }
Exemplo n.º 4
0
        public ActionResult Delete(Guid Id)
        {
            Guid?ParentId = new DbController.Model_Group().Select().Where(x => x.OtherProps.Id == Id).FirstOrDefault().OtherProps.ParentId;

            if (!new DbController.Model_Group().Delete(Id))
            {
                ViewData["Message"] = "گروه حذف نشد";
                return(View());
            }
            else
            {
                return(RedirectToRoute(new { id = ParentId, action = "Index", controller = "Menu" }));
            }
        }