public async Task <ActionResult> Default(LearningSupport learningSupport) { Application application = await _applicationService.GetCurrentApplication(_ctx); await _disabilityService.SaveDisabilities(application, learningSupport.Disability, _ctx); await _learningSupportService.SaveLearningSupport(learningSupport, application, _ctx); return(RedirectToAction("Manage", "Applications")); }
public async Task <ActionResult> Default() { Application application = await _applicationService.GetCurrentApplication(_ctx); LearningSupport learningSupport = await _applicationService.GetLearningSupport(_ctx) ?? new LearningSupport(); learningSupport.Disability = await _disabilityService.SelectDisabilities(application, _ctx); return(View(learningSupport)); }
/// <summary> /// Save learning support details related to the current application. /// </summary> /// <param name="learningSupport"></param> /// <param name="application"></param> /// <param name="_ctx"></param> /// <returns></returns> public async Task SaveLearningSupport(LearningSupport learningSupport, Application application, StudentPortalContext _ctx) { learningSupport.Application = application; LearningSupport currentSupport = await _applicationService.GetLearningSupport(_ctx); if (currentSupport != null) { learningSupport.Id = currentSupport.Id; } _ctx.LearningSupport.AddOrUpdate(l => l.Id, learningSupport); await _ctx.SaveChangesAsync(); }