コード例 #1
0
        public ActionResult Edit(string id)
        {
            var form = _context.Get <ApplicationUser>(d => d.Id == id).Project().To <UserViewModel>().SingleOrDefault();

            if (form == null)
            {
                return(RedirectToAction <HomeController>(c => c.Index()).WithError("Unable to find the alumni."));
            }
            return(View(form));
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: arthurlv6/icaDemo
        public ActionResult Menu()
        {
            var college = CacheHelper.GetCache <College>(CacheType.College).Where(d => d.LanguageId == 1).FirstOrDefault();
            var menu    = _context.Get <WebMenu>(d => d.WebLanguage.Name == "English").ToList();
            //CacheHelper.GetCache<WebMenu>(CacheType.WebMenu).Where(d => d.LanguageId == 1).ToList();

            var temp = new MainPageMenuViewModel();

            temp.College  = college;
            temp.WebMenus = menu;

            return(View(temp));
        }
コード例 #3
0
        public ActionResult Index(long?languageId = 1)
        {
            ViewBag.selected = languageId;
            var modal = _context.Get <WebStaff>(d => d.LanguageId == languageId).OrderByDescending(d => d.Id).Include(d => d.WebDepartment).ToList();

            return(View(modal));
        }
コード例 #4
0
        public ActionResult Index(string id = "Undefined")
        {
            var condition = new ConditionViewModel <UserFile>()
            {
                ChangeOrderDirection = false, OrderDirection = "desc"
            };

            if (string.IsNullOrEmpty(id))
            {
                condition.Func = d => d.Deleted != true && d.Category == "Undefined";
            }
            else
            {
                condition.Func = d => d.Deleted != true && d.Category == id;
            }
            condition.PerPageSize = 300;
            condition.CurrentPage = 1;
            var viewModel = new UploadFileViewModel();

            viewModel.CategoryList = _db.Get <UserFile>(d => d.Deleted != true).GroupBy(d => d.Category).Select(g => new SelectListItem
            {
                Text     = g.Key,
                Value    = g.Key,
                Selected = g.Key == id
            }).ToArray();
            viewModel.Data = _db.GetSearchResult(condition, d => d.OperationDate, null);
            return(View(viewModel));
        }
コード例 #5
0
        public JsonResult _OperatorEdit(OperatorViewModel input)
        {
            _context.Get <ApplicationUser>(d => d.Id == input.Id).FirstOrDefault().UpdateDatetime = _context.GetNzTime();
            var opteratorRoles = _context.Get <IdentityUserRole>(d => d.UserId == input.Id).ToList();

            foreach (var item in opteratorRoles)
            {
                if (input.RolePosted != null)
                {
                    if (!input.RolePosted.ids.Any(d => d == item.RoleId))
                    {
                        var entity = _context.Get <IdentityUserRole>(d => d.RoleId == item.RoleId && d.UserId == input.Id).FirstOrDefault();
                        _context.GetTranscaiton().Entry(entity).State = EntityState.Deleted;
                    }
                }
                else
                {
                    var entity = _context.Get <IdentityUserRole>(d => d.RoleId == item.RoleId && d.UserId == input.Id).FirstOrDefault();
                    _context.GetTranscaiton().Entry(entity).State = EntityState.Deleted;
                }
            }
            _context.SaveChange();
            if (input.RolePosted != null)
            {
                foreach (var item in input.RolePosted.ids)
                {
                    if (!opteratorRoles.Any(d => d.RoleId == item))
                    {
                        _context.AddOneEntity <IdentityUserRole>(new IdentityUserRole {
                            UserId = input.Id, RoleId = item
                        });
                    }
                }
            }
            return(Json("1", JsonRequestBehavior.AllowGet));
        }
コード例 #6
0
 public ActionResult Index()
 {
     return(View(_context.Get <WebLanguage>(d => true)));
 }
コード例 #7
0
 public ActionResult Index(long languageId = 1)
 {
     ViewBag.selected = languageId;
     return(View(_context.Get <WebEvent>(d => d.LanguageId == languageId).OrderByDescending(d => d.Id)));
 }
コード例 #8
0
 public ActionResult Index(Int64 languageId = 1)
 {
     ViewBag.selected = languageId;
     return(View(_context.Get <WebCarousel>(d => d.LanguageId == languageId)));
 }
コード例 #9
0
 public ActionResult Index(Int64 languageId = 1)
 {
     ViewBag.selected = languageId;
     return(View(_context.Get <College>(d => d.LanguageId == languageId).FirstOrDefault()));
 }
コード例 #10
0
 public ActionResult Index(long languageId = 1)
 {
     ViewBag.selected = languageId;
     return(View(_context.Get <WebMenu>(d => d.LanguageId == languageId).Include("WebLanguage")));
 }
コード例 #11
0
 public ActionResult Index()
 {
     return(View(_context.Get <WebCarouselBackground>(d => true)));
 }