Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        //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));
        }