Exemplo n.º 1
0
        public ActionResult CapNhat(int Id)
        {
            var _user = _db.UserLogins.Find(User.Identity.Name);

            if (_user != null && _user.sessionId != HttpContext.Session.SessionID)
            {
                AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
            }
            int _languageId = 1;
            var entity      = _services.GetById(Id);
            var model       = new ModelDanhMuc
            {
                Id       = entity.menuId,
                isSort   = entity.isSort,
                isTrash  = entity.isTrash,
                Link     = entity.menuLink,
                Name     = entity.menuName,
                ParentId = entity.menuParentId
            };
            var category = _services.Dropdownlist(0, model.Id, _languageId);

            ViewBag.ParentId = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            return(View(model));
        }
Exemplo n.º 2
0
        public ActionResult ThemMoi()
        {
            int _languageId = 1;

            var model = new ModelDanhMuc
            {
                Id = 0
            };
            var category = _services.Dropdownlist(0, model.Id, _languageId);

            ViewBag.ParentId = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            return(View(model));
        }
Exemplo n.º 3
0
        public ActionResult CapNhat(int Id)
        {
            int _languageId = 1;
            var entity      = _services.GetById(Id);
            var model       = new ModelDanhMuc
            {
                Id       = entity.menuId,
                isSort   = entity.isSort,
                isTrash  = entity.isTrash,
                Link     = entity.menuLink,
                Name     = entity.menuName,
                ParentId = entity.menuParentId
            };
            var category = _services.Dropdownlist(0, model.Id, _languageId);

            ViewBag.ParentId = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            return(View(model));
        }
Exemplo n.º 4
0
        public ActionResult CapNhat(ModelDanhMuc model)
        {
            if (ModelState.IsValid)
            {
                var entity = _services.GetById(model.Id);
                entity.menuName     = model.Name;
                entity.menuLink     = model.Link;
                entity.menuParentId = model.ParentId;
                entity.isSort       = model.isSort;
                _services.Update(entity);
                _services.Save();
                return(RedirectToAction("Index", new { _parentId = entity.menuParentId }));
            }
            var category = _services.Dropdownlist(0, model.Id, 1);

            ViewBag.ParentId = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            return(View(model));
        }
Exemplo n.º 5
0
        public ActionResult ThemMoi()
        {
            var _user = _db.UserLogins.Find(User.Identity.Name);

            if (_user != null && _user.sessionId != HttpContext.Session.SessionID)
            {
                AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
            }
            int _languageId = 1;

            var model = new ModelDanhMuc
            {
                Id = 0
            };
            var category = _services.Dropdownlist(0, model.Id, _languageId);

            ViewBag.ParentId = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            return(View(model));
        }
Exemplo n.º 6
0
        public ActionResult ThemMoi(ModelDanhMuc model)
        {
            if (ModelState.IsValid)
            {
                var entity = new Menu();
                entity.menuName     = model.Name;
                entity.menuLink     = model.Link;
                entity.menuParentId = model.ParentId;
                entity.isSort       = model.isSort;
                entity.isTrash      = false;
                entity.languageId   = 1;
                _services.Add(entity);
                _services.Save();
                return(RedirectToAction("Index", new { _parentId = entity.menuParentId }));
            }
            var category = _services.Dropdownlist(0, model.Id, 1);

            ViewBag.ParentId = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            return(View(model));
        }