示例#1
0
 public ActionResult addstaff(Models.staff astaff)
 {
     using (QuanLyCafeEntities db = new QuanLyCafeEntities())
     {
         data.allstaffs = db.staffs.ToList();
         int    idaccount = data.allstaffs[data.allstaffs.Count() - 1].idaccount + 1;
         string username;
         if (string.Compare(astaff.position, "Ban quản lý", true) == 0)
         {
             username = "******" + idaccount.ToString();
         }
         else
         {
             username = "******" + idaccount.ToString();
         }
         string password = "******";
         string type;
         if (string.Compare(astaff.position, "Ban quản lý", true) == 0)
         {
             type = "admin";
         }
         else
         {
             type = "staff";
         }
         db.Addstaffaccountlatest(astaff.name, astaff.status, astaff.position, astaff.email, idaccount, username, password, type);
     }
     return(RedirectToAction("setting", "Home", new { area = "admin" }));
 }
示例#2
0
 public ActionResult savestaff(Models.staff savestaff)
 {
     try
     {
         db.updatestaff(savestaff.idstaff, savestaff.name, savestaff.status, savestaff.position, savestaff.email, savestaff.idaccount);
     }
     catch
     {
         return(RedirectToAction("setting", "Home", new { area = "admin" }));
     }
     return(RedirectToAction("setting", "Home", new { area = "admin" }));
 }