public async Task<IActionResult> NewApplication(NewApplicationViewModel model) { if (!ModelState.IsValid) { return View(model); } var application = new Application { Id = Guid.NewGuid(), Name = model.Name, SupervisorId = model.SelectedProcess }; await _applicationRepository.NewApplication(application); Success($"Application {application.Name} added."); return RedirectToAction("Index", "Admin"); }
public async Task<Application> NewApplication(Application application) { _db.Applications.Add(application); await _db.SaveChangesAsync(); return application; }