public async Task <IActionResult> CreateDirector(string id) { if (ModelState.IsValid) { Director newDirector = new Director() { Id = 0, ApplicationUserId = id }; _context.Add(newDirector); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(AllProjects), new ProjectListRoute() { index = 1, viewingyours = false })); } var user = await GetCurrentUserAsync(); var director = _context.Director .FirstOrDefaultAsync(d => d.ApplicationUserId == user.Id); var UserDirector = new UserHasDirectorViewModel() { hasDirectorAccout = director == null, User = user }; return(View(UserDirector)); }
//Get: Projects/ public async Task <ActionResult> DirectorAgreement() { var user = await GetCurrentUserAsync(); var director = await _context.Director .FirstOrDefaultAsync(d => d.ApplicationUserId == user.Id); var UserDirector = new UserHasDirectorViewModel() { hasDirectorAccout = director != null, User = user }; return(View(UserDirector)); }