public ActionResult Login(LoginForm form) { try { if (ModelState.IsValid) { AdminService repo = new AdminService(); CD.Admin a = repo.Check(new CD.Admin(form.Email, form.Password)); if (a == null) { return(View(form)); } UserSession.CurrentUser = new User { Id = a.Id, Email = a.Email, AdminId = a.AdminId }; return(RedirectToAction("Index", "Employee", a.Id)); } else { return(View(form)); } } catch (Exception) { return(View(form)); } }
internal static G.Admin ToGlobal(this C.Admin admin) { return(new G.Admin() { AdminId = admin.AdminId, StartDate = admin.StartDate, EndDate = admin.EndDate, EmployeeId = admin.Id, LastName = admin.LastName, FirstName = admin.FirstName, Email = admin.Email, Password = admin.Password, RegNat = admin.RegNat, HireDate = admin.HireDate, Avatar = admin.Avatar, City = admin.City, Street = admin.Street, Number = admin.Number, NumberBox = admin.NumberBox, ZipCode = admin.ZipCode, Country = admin.Country, GSM = admin.GSM, BirthDate = admin.BirthDate }); }
internal static G.Admin ToLoginGlobal(this C.Admin admin) { return(new G.Admin() { Email = admin.Email, Password = admin.Password }); }
public EmployeeEditForm(C.Admin admin, C.Department currentDepartment, IEnumerable <C.Department> departmentList) : this(admin, currentDepartment, departmentList, admin.IsAdmin) { }