Пример #1
0
        public IActionResult Index()
        {
            var result = _PeerCriteria.PeerCriteriaHeaders()
                         .Select(a => new PeerCriteriaHeaderViewModel
            {
                Id          = a.Id,
                Title       = a.Title,
                Description = a.Description,
                Weight      = a.Weight
            }).ToList();
            var aes    = _PeerCriteria.ActiveSeason();
            var season = new EvaluationSeasonItem();

            if (aes != null)
            {
                season.Id        = aes.Id;
                season.Title     = aes.Title;
                season.Remarks   = aes.Remarks;
                season.StartDate = aes.StartDate;
                season.EndDate   = aes.EndDate;
            }
            ;
            var model = new PeerCriteriaIndexViewModel
            {
                Criterias          = result,
                IsWithActiveSeason = _PeerCriteria.IsWithActiveSeason(),
                ActiveSeason       = season,
            };

            return(View(model));
        }
Пример #2
0
        public IActionResult Save(PeerCriteriaIndexViewModel model)
        {
            var UserId = int.Parse(HttpContext.Session.GetString("UserId"));

            if (ModelState.IsValid)
            {
                var item = new PeerCriteria
                {
                    Id          = model.PeerCriteria.Id,
                    Title       = model.PeerCriteria.Title,
                    Description = model.PeerCriteria.Description,
                    Weight      = model.PeerCriteria.Weight
                };
                _PeerCriteria.SavePeerCriteria(item, UserId);
            }
            return(RedirectToAction("Index"));
        }