public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Employee = await _context.Employee
                       .Include(e => e.Company)
                       .Include(e => e.Department)
                       .Include(e => e.EmployeeType)
                       .Include(e => e.Location)
                       .Include(e => e.Position).FirstOrDefaultAsync(m => m.EmployeeID == id);

            if (Employee == null)
            {
                return(NotFound());
            }
            ViewData["Company_CompanyID"]           = new SelectList(_context.Company, "CompanyID", "Image");
            ViewData["Department_DepartmentID"]     = new SelectList(_context.Department, "DepartmentID", "DepartmentName");
            ViewData["EmployeeType_EmployeeTypeID"] = new SelectList(_context.Set <EmployeeType>(), "EmployeeTypeID", "EmployeeTypeID");
            ViewData["Location_LocationID"]         = new SelectList(_context.Location, "LocationID", "LocationName");
            ViewData["Position_PositionID"]         = new SelectList(_context.Set <Position>(), "PositionID", "PositionID");
            return(Page());
        }
Exemple #2
0
 public IActionResult OnGet()
 {
     ViewData["Company_CompanyID"]           = new SelectList(_context.Company, "CompanyID", "Image");
     ViewData["Department_DepartmentID"]     = new SelectList(_context.Department, "DepartmentID", "DepartmentName");
     ViewData["EmployeeType_EmployeeTypeID"] = new SelectList(_context.Set <EmployeeType>(), "EmployeeTypeID", "EmployeeTypeID");
     ViewData["Location_LocationID"]         = new SelectList(_context.Location, "LocationID", "LocationName");
     ViewData["Position_PositionID"]         = new SelectList(_context.Set <Position>(), "PositionID", "PositionID");
     return(Page());
 }
Exemple #3
0
        public async Task <IActionResult> OnPostAsync()
        {
            string Username = Request.Form["Username"];
            string Password = Request.Form["Password"];

            Debug.WriteLine(Username);
            if (Username == string.Empty && Password == string.Empty)
            {
                return(Page());
            }


            Login = await _context.Login.Include(e => e.Employee)
                    .FirstOrDefaultAsync(u => u.Username.Equals(Username));

            if (Login == null)
            {
                return(Page());
            }
            if (!Login.Password.Equals(Password))
            {
                return(Page());
            }
            ViewData["Employee_EmployeeID"] = new SelectList(_context.Set <Employee>(), "EmployeeID", "EmployeeID");
            Debug.WriteLine(Login.Employee_EmployeeID);



            return(RedirectToPage("./Homes/Home", new { id = Login.Employee.EmployeeID }));
        }