//Delete an existing data entry
        public async Task <Employee> DeleteAsync(int?id)
        {
            try
            {
                var getEmpId = await Employee.Where(f => f.EmployeeNumber == id).Select(f => f.EmpId).ToListAsync();

                var getMonthlyIncomeId = await Employee.Where(f => f.EmployeeNumber == id).Select(f => f.MonthlyIncomeId).ToListAsync();

                var getHistoryId = await Employee.Where(f => f.EmployeeNumber == id).Select(f => f.EmpHistoryId).ToListAsync();

                var getUserEmail = await Employee.Where(f => f.EmployeeNumber == id).Select(f => f.Emp.Email).FirstAsync();

                var employee = await Employee.FindAsync(id);

                var employeedetails = await EmployeeDetails.FindAsync(getEmpId.ElementAt(0));

                var costtocompany = await CostToCompany.FindAsync(getMonthlyIncomeId.ElementAt(0));

                var employeehistory = await EmployeeHistory.FindAsync(getHistoryId.ElementAt(0));

                var getAllEmails = await AspNetUsers.Select(a => a.Email).ToListAsync();

                //Employee.Remove(employee);
                EmployeeDetails.Remove(employeedetails);
                CostToCompany.Remove(costtocompany);
                EmployeeHistory.Remove(employeehistory);

                if (getAllEmails.Contains(getUserEmail))
                {
                    var empRoleEmail = await AspNetUsers.Where(a => a.Email == getUserEmail).FirstAsync();

                    AspNetUsers.Remove(empRoleEmail);
                }

                await SaveChangesAsync();

                return(employee);
            }
            catch (DbUpdateConcurrencyException)
            {
                return(NotFound());
            }
        }