public ActionResult CreateStaffAccount(Staff staff)
 {
     HttpCookie aCookie = Request.Cookies["UserSettings"];
     if (aCookie == default(HttpCookie))
     {
         return RedirectToAction("Index");
     }
     else
     {
         if (aCookie["Role"] == "SystemAdmin")
         {
             RestaurantDatabaseEntities db = new RestaurantDatabaseEntities();
             if (staff.staffName == null)
             {
                 return RedirectToAction("CreateStaffAccount/1");
             }
             else
             {
                 if (ModelState.IsValid)
                 {
                     Staff existingStaff = db.Staffs.FirstOrDefault(x => x.staffName == staff.staffName);
                     if (existingStaff == default(Staff))
                     {
                         if (staff.password == null || staff.password.Length < 6)
                         {
                             return RedirectToAction("CreateStaffAccount/2");
                         }
                         else
                         {
                             using (MD5 hash = MD5.Create())
                             {
                                 staff.password = GetMd5Hash(hash, staff.password);
                             }
                             db.Staffs.Add(staff);
                             db.SaveChanges();
                             return RedirectToAction("Index");
                         }
                     }
                     else
                     {
                         return RedirectToAction("CreateStaffAccount/1");
                     }
                 }
                 else
                 {
                     return RedirectToAction("CreateStaffAccount/1");
                 }
             }
         }
         return RedirectToAction("Index");
     }
 }
 public ActionResult CreateStaffAccount(Staff staff)
 {
     HttpCookie aCookie = Request.Cookies["UserSettings"];
     if (aCookie == default(HttpCookie))
     {
         return RedirectToAction("Index");
     }
     else
     {
         if (aCookie["Role"] == "Staff")
         {
             RestaurantDatabaseEntities db = new RestaurantDatabaseEntities();
             if (staff.staffName == null)
             {
                 return RedirectToAction("CreateStaffAccount/1");
             }
             else
             {
                 if (ModelState.IsValid)
                 {
                     db.Staffs.Add(staff);
                     db.SaveChanges();
                     return RedirectToAction("Index");
                 }
                 else
                 {
                     return RedirectToAction("CreateStaffAccount/1");
                 }
             }
         }
         return RedirectToAction("Index");
     }
 }