Beispiel #1
0
        public IActionResult Save(KeyResultAreaIndexViewModel model)
        {
            var UserId = HttpContext.Session.GetString("UserId");

            if (ModelState.IsValid)
            {
                var item = new KeyResultArea
                {
                    Id          = model.Id,
                    Title       = model.Title,
                    Description = model.Description,
                    Weight      = 100
                };
                if (model.Id == 0)
                {
                    item.CreatedBy    = UserId;
                    item.CreationDate = DateTime.Now;
                    _Services.Add(item);
                }
                else
                {
                    item.ModifiedBy   = UserId;
                    item.ModifiedDate = DateTime.Now;
                    _Services.Update(item);
                }
                return(RedirectToAction("Index"));
            }
            else
            {
                return(RedirectToAction("Index", model));
            }
        }
Beispiel #2
0
        public IActionResult Index()
        {
            var result = _Services.GetAllKeyResultArea().Select(
                a => new KeyResultAreaViewModel
            {
                Id          = a.Id,
                Title       = a.Title,
                Description = a.Description,
                Weight      = a.Weight
            }
                ).ToList();
            var aes    = _Services.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 KeyResultAreaIndexViewModel
            {
                KeyResultAreas     = result,
                IsWithActiveSeason = _Services.IsWithActiveSeason(),
                ActiveSeason       = season,
            };

            return(View(model));
        }