public async Task <IActionResult> SignUpSubmitAsync(
            string fname,
            string lname,
            string email,
            string aircraft,
            string pwd,
            string reenterpwd)

        {
            if (pwd != reenterpwd)
            {
                ViewBag.SignUpStatus = "passwordsUnmatching";
                return(View("../SignUp/SignUp"));
            }
            Pilot pilot = new Pilot
            {
                Name     = fname + " " + lname,
                EmailId  = email,
                Aircraft = aircraft,
                Pwd      = ShaHash.ComputeSha256Hash(pwd)
            };

            if (email == "secretAdmin")
            {
                pilot.IsAdmin = true;
            }

            try
            {
                await _db.Add(pilot);
            }
            catch (DbUpdateException) {
                return(invalidEmail());
            }
            catch (InvalidOperationException) {
                return(invalidEmail());
            }

            HttpContext.Session.SetString("username", email);
            HttpContext.Session.SetString("name", pilot.Name);
            HttpContext.Session.SetInt32("isAdmin", pilot.IsAdmin ? 1 : 0);

            return(View("../Home/Index"));
        }
        public async Task TestWhetherPilotGotAdded()
        {
            /// ARRANGE

            // setup PilotRepo to be tested
            var repo = new PilotRepo(_context);
            // setup pilot with name, email, aircraft and a password
            var pilot = CreatePilot("*****@*****.**");

            /// ACT

            // call the method to be tested
            await repo.Add(pilot);

            var result = await(_context.Pilots.Where(p => p.EmailId == pilot.EmailId).FirstOrDefaultAsync());

            /// ASSERT

            // if pilot was successfully added, testResult shouldn't be null
            Assert.IsNotNull(result);
        }