예제 #1
0
 public ActionResult profile(HotelModelClass admin)
 {
     if (ModelState.IsValid)
     {
         db.Entry(admin).State = EntityState.Modified;
         db.SaveChanges();
         TempData["SuccessMessage"] = "your profile is updated";
         return(RedirectToAction("profile"));
     }
     else
     {
         return(View(admin));
     }
 }
예제 #2
0
 public ActionResult RemoveAdmin(int?Admin_ID)
 {
     if (Session["Admin_Name"] != null)
     {
         AuthenticateUser authenticateUser = db.authenticateUser.Where(x => x.Admin_ID == Admin_ID).FirstOrDefault();
         db.authenticateUser.Remove(authenticateUser);
         db.SaveChanges();
         HotelModelClass admin = db.hotelModelClass.Find(Admin_ID);
         db.hotelModelClass.Remove(admin);
         db.SaveChanges();
         return(RedirectToAction("RemoveAdmin", "Admin"));
     }
     else
     {
         return(RedirectToAction("LogIn", "User"));
     }
 }
예제 #3
0
 public ActionResult profile()
 {
     if (Session["Admin_ID"] != null)
     {
         //string User_ID = Session["User_ID"].ToString();
         //int ID = int.Parse(User_ID);
         //HotelModelClass admin = db.hotelModelClass.Where(x => x.Admin_ID == ID).FirstOrDefault();
         //return View(admin);
         string          email = Session["Admin_Email"].ToString();
         HotelModelClass admin = db.hotelModelClass.Where(x => x.Email == email).FirstOrDefault();
         return(View(admin));
     }
     else
     {
         return(RedirectToAction("LogIn", "User"));
     }
 }
예제 #4
0
 public ActionResult AddNewAdmin(HotelModelClass Admin)
 {
     if (Session["Admin_Name"] != null)
     {
         if (ModelState.IsValid)
         {
             db.hotelModelClass.Add(Admin);
             db.SaveChanges();
             HotelModelClass adminID   = db.hotelModelClass.Where(x => x.Name == Admin.Name && x.Email == Admin.Email && x.password == Admin.password && x.phone == Admin.phone).FirstOrDefault();
             UserClass       userclass = new UserClass();
             userclass.LevelOneAuthenticateUser(Admin.Name, Admin.password, Admin.Email, adminID.Admin_ID);
             return(RedirectToAction("RemoveAdmin"));
         }
         return(View(Admin));
     }
     else
     {
         return(RedirectToAction("LogIn", "User"));
     }
 }