示例#1
0
        public ActionResult ThemMoiDonVi(ModelDonVi model)
        {
            if (ModelState.IsValid)
            {
                Content entity = new Content
                {
                    contentAlias      = model.Link,
                    contentUpdateTime = DateTime.Now,
                    contentParentId   = model.DonviCha,
                    contentName       = model.TenDonVi,
                    contentCreateTime = DateTime.Now,
                    isSort            = model.ThuTu,
                    isTrash           = false,
                    contentView       = 0,
                    contentLanguageId = 1,
                    contentKey        = "DONVIPHONGKHOA",
                    contentCreateUser = User.Identity.Name,
                    contentUpdateUser = User.Identity.Name
                };
                _services.Add(entity);
                _services.Save();
                entity.contentAlias = entity.contentAlias + "-" + entity.contentId;
                _services.Update(entity);
                _services.Save();
                return(RedirectToAction("Index", new { _parentId = entity.contentParentId }));
            }
            IEnumerable <DropdownModel> category = _services.Dropdownlist(0, (int)model.DonViId, "DONVIPHONGKHOA", 1);

            ViewBag.DonviCha = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            return(View(model));
        }
示例#2
0
        public ActionResult ThemMoiDonVi()
        {
            var model = new ModelDonVi {
                DonViId = 0
            };
            IEnumerable <DropdownModel> category = _services.Dropdownlist(0, null, "DONVIPHONGKHOA", 1);

            ViewBag.DonviCha = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            return(View(model));
        }
示例#3
0
        public ActionResult CapNhat(ModelDonVi model)
        {
            if (ModelState.IsValid)
            {
                Content entity = _services.GetById((int)model.DonViId);
                entity.contentUpdateTime = DateTime.Now;
                entity.contentParentId   = model.DonviCha;
                entity.contentName       = model.TenDonVi;
                entity.contentUpdateUser = User.Identity.Name;
                _services.Update(entity);
                _services.Save();
                return(RedirectToAction("Index", new { _parentId = entity.contentParentId }));
            }
            IEnumerable <DropdownModel> category = _services.Dropdownlist(0, (int)model.DonViId, "DONVIPHONGKHOA", 1);

            ViewBag.DonviCha = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            return(View(model));
        }
示例#4
0
 public ActionResult CapNhat(int Id)
 {
     if (Id > 0)
     {
         var entity = _services.GetById(Id);
         var model  = new ModelDonVi
         {
             DonViId  = entity.contentId,
             Link     = entity.contentAlias,
             TenDonVi = entity.contentName,
             DonviCha = entity.contentParentId
         };
         IEnumerable <DropdownModel> category = _services.Dropdownlist(0, (int)model.DonViId, "DONVIPHONGKHOA", 1);
         ViewBag.DonviCha = category.Select(x => new SelectListItem {
             Text = x.Text, Value = x.Value.ToString()
         });
         return(View(model));
     }
     else
     {
         return(View());
     }
 }