public async Task <ActionResult> AddRisk(RiskFormStub model) { ResponseModel response = new ResponseModel(true); Business.Entities.Risk dbItem = new Business.Entities.Risk(); model.CreatedBy = model.ModifiedBy = User.UserName; model.CreatedDate = model.ModifiedDate = DateTime.Now; if (ModelState.IsValid) { dbItem = model.GetDbObject(); await RiskRepo.CreateAsync(dbItem); if (RiskRepo.Id != 0) { model.RiskId = RiskRepo.Id; ViewBag.riskImpacts = GetRiskImpacts(model.RiskId); ViewBag.riskMitigations = GetRiskMitigations(model.RiskId); return(View("_RiskDetails", model)); } else { return(View("_FormRisk", model)); } } else { return(View("_FormRisk", model)); } }