public static void fillCookie() { string username = HttpContext.Current.User.Identity.Name; tbStaff staff = StaffApiRequestHelper.getStaffData(username); SetCookie(staff.ID, staff.Name, staff.Username, staff.Role, staff.HospitalID ?? 0, staff.HospitalName); }
public async Task <ActionResult> Index(tbStaff staff) { tbStaff staffdata = await StaffApiRequestHelper.Login(staff); if (staffdata != null) { FormsAuthentication.SetAuthCookie(staffdata.Username, false); SetCookie(staffdata.ID, staffdata.Name, staffdata.Username, staffdata.Role, staffdata.HospitalID ?? 0, staffdata.HospitalName); return(RedirectToAction("Index", "DoctorSchedule")); } else { ViewBag.Status = "Unauthorize"; return(View()); } }