public ActionResult Login(Hotel.Domain.Domains.Hotel hotel) { var result = Service.LoginService.HotelLogin(hotel); if (result != null) { Core.SessionSetting.SessionSetting.SessionSet <Hotel.Domain.Domains.Hotel> .Set(result, "LoginHotel"); var hotelOwner = Core.SessionSetting.SessionSetting.SessionSet <Hotel.Domain.Domains.Hotel> .Get("LoginHotel"); Session["nameHotel"] = hotelOwner.HotelName; if (hotelOwner.Id != null) { Service.LoginService.AddRedis(); return(RedirectToAction("Index", "Home")); } else { return(View()); } } else { ModelState.AddModelError("", "Failed to login. Please try again."); return(RedirectToAction("Login")); } }
public ActionResult Register(Hotel.Domain.Domains.Hotel hotel) { var result = Service.LoginService.HotelRegister(hotel); if (result == "Success") { return(RedirectToAction("Login")); } else { ModelState.AddModelError("", "No Success!! Try Again with new email."); return(View()); } }
public string HotelRegister(Hotel.Domain.Domains.Hotel hotel) { using (BaseRepository <Domain.Domains.Hotel> _bR = new BaseRepository <Domain.Domains.Hotel>()) { var email = hotel.Email; var pass = hotel.Password; var result = _bR.Query <Domain.Domains.Hotel>().Where(c => c.Email.Equals(email)).Any(); if (!result) { _bR.Add(hotel); return("Success"); } else { return("No Success!!"); } } }