public IActionResult Index() { if (!Authentication.AuthenticateByCookie(HttpContext)) { return(Redirect("/Receptionists/Authentication/Login?are=Receptionists&ctrl=Staff&act=Index")); } List <Staff> list = StaffDA0.GetAllStaffs(); return(View(list)); }
public IActionResult CheckStaffIsExists(int id) { if (StaffDA0.CheckIsExistStaffByID(id)) { return(Json(true)); } else { return(Json(false)); } }
public IActionResult CreateStaff(Staff staff) { if (!StaffDA0.CheckIsExistStaffByID(staff.StaffID)) { StaffDA0.InsertStaff(staff); return(Json(staff.StaffID)); } else { return(Json(null)); } }
public IActionResult Check(int staffID, string password, Path path) { if (StaffDA0.CheckLoginAccess(staffID, password)) { //khởi tạo cookie cho browser CookieOptions cookie = new CookieOptions(); cookie.Expires = DateTime.Now.AddMilliseconds(3600000); Response.Cookies.Append("staffid", staffID.ToString(), cookie); Response.Cookies.Append("password", password, cookie); if (path.Ctrl != null) { return(Redirect(path.ToString())); } else { return(Redirect("/Receptionists/Rooms")); } } else { return(Redirect("/Receptionists/Login")); } }
public IActionResult UpdateStaff(Staff staff) { StaffDA0.UpdateStaff(staff); return(Json(staff.StaffID)); }