public string GetRoomsByCategoryHtml() { DAL dal = new DataAbstractionLayer.DAL(); // get the category from the request string category = Request.Params["category"]; List <Room> roomsList = dal.GetAllRooms(); List <Room> matchingRooms = new List <Room>(); foreach (Room room in roomsList) { if (room.Category == category) { matchingRooms.Add(room); } } string result = m_tableHeader; foreach (Room room in matchingRooms) { result += AddRoomFieldsToTableData(room); } result += "</table>"; return(result); }
public ActionResult Login() { DAL dal = new DataAbstractionLayer.DAL(); string userName = Request.Params["username"]; string password = Request.Params["password"]; // see if we have this user User user = dal.Authenticate(userName, password); if (user == null) { Debug.WriteLine("User login failed!"); return(View("Error")); } // set up the ViewData with our user, so he can book rooms ViewData["user"] = user; return(View("FilterRooms")); }