public IActionResult Content(int id) { var kra = _Services.GetKeyResultAreaById(id); var result = _Services.SuccessIndicatorPerKRA(id).Select ( a => new KeySuccessIndicatorViewModel { Id = a.Id, Title = a.Title, Description = a.Description, Weight = a.Weight } ).ToList(); var RatingTables = _Services.GetRatingTables().Select(a => new RatingTableViewModel { Id = a.Id, Description = a.Description }).ToList(); var item = new KeyResultAreaContentViewModel { KeyResultAreaId = kra.Id, Title = kra.Title, Description = kra.Description, SuccessIndicators = result, RatingTables = RatingTables, }; return(View(item)); }
public IActionResult SaveKeySuccessIndicator(KeyResultAreaContentViewModel model) { var UserId = HttpContext.Session.GetString("UserId"); if (ModelState.IsValid) { var item = new KeySuccessIndicator { Id = model.KSIId, Title = model.KSITitle, Description = model.KSIDescription, KeyResultArea = _Services.GetKeyResultAreaById(model.KRAId), Weight = model.KSIWeight }; _Services.SaveKeySuccessIndicator(item, UserId); return(RedirectToAction("Content", new { id = model.KRAId })); } else { return(RedirectToAction("Content", new { id = model.KeyResultAreaId })); } }
public IActionResult RemoveSuccessIndicator(KeyResultAreaContentViewModel model) { _Services.RemoveSuccessIndicatorById(model.KSIId); return(RedirectToAction("Content", new { id = model.KRAId })); }