public async Task <IActionResult> Edit(JobApplicationEditView model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            string email = User.FindFirst(x => x.Type.Equals(ClaimTypes.Email)).Value;
            int?   id    = _context.Users.Where(x => x.Email == email).First().Id;

            if (id == null)
            {
                return(BadRequest($"id shouldn't not be null"));
            }
            JobApplication ja = await _context.JobApplications.FirstOrDefaultAsync(x => x.Id == model.Id);

            ja.FirstName        = model.FirstName;
            ja.LastName         = model.LastName;
            ja.PhoneNumber      = model.PhoneNumber;
            ja.EmailAddress     = model.EmailAddress;
            ja.ContactAgreement = model.ContactAgreement;
            _storage.deleteFromStorage(ja);
            _storage.AddToStorage(ja, model.FormFile);

            _context.Update(ja);
            await _context.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> CreateJobApplication(JobApplicationCreateView model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            string email = User.FindFirst(x => x.Type.Equals(ClaimTypes.Email)).Value;
            int?   id    = _context.Users.Where(x => x.Email == email).First().Id;

            if (id == null)
            {
                return(BadRequest($"id shouldn't not be null"));
            }
            JobApplication ja = new JobApplication
            {
                JobOfferId       = model.JobOfferId,
                FirstName        = model.FirstName,
                LastName         = model.LastName,
                PhoneNumber      = model.PhoneNumber,
                EmailAddress     = model.EmailAddress,
                ContactAgreement = model.ContactAgreement,
                UserId           = (int)id
            };

            _storage.AddToStorage(ja, model.FormFile);
            await _sendgrid.SendMailNotification(ja);

            await _context.JobApplications.AddAsync(ja);

            await _context.SaveChangesAsync();

            return(RedirectToAction("IndexUser", "Home"));
        }