public ActionResult Index() { if (isNotLogin()) { if (Request.Form["username"] != null && Request.Form["password"] != null) { String username = Request.Form["username"]; String password = Request.Form["password"]; using (var model = new Models.Hotel_Amazonian_WillowEntities()) { if (model.Administrador.Where(x => x.correo == username && x.contrasenna == password).FirstOrDefault() != null) { Models.Administrador administrador = model.Administrador.Where(x => x.correo == username && x.contrasenna == password).FirstOrDefault(); Session["username"] = username; Session["nombre"] = administrador.nombre; return View(); } else { ViewData["error"] = "Nombre de usuario o contraseña incorrecta"; return View("Login"); } } } else { ViewData["error"] = "Debe iniciar sesión"; return View("Login"); } } return View(); }
public PartialViewResult _Advertising() { using (var mo = new Models.Hotel_Amazonian_WillowEntities()) { ViewData["Advertisng"] = mo.Publicidad.Include(p => p.Imagen1).ToList(); } return(PartialView()); }
public ActionResult OnlineBook() { using (var mo = new Models.Hotel_Amazonian_WillowEntities()) { ViewData["types"] = mo.Tipo_Habitacion.ToList(); } return View(); }//OnlineBook
public ActionResult ShowPromotion(int id) { using (var mo = new Models.Hotel_Amazonian_WillowEntities()) { ViewData["Promotion"] = mo.Promocion.Where(p => p.id == id).Include(p => p.Tipo_Habitacion).Include(p => p.Tipo_Habitacion.Imagen1).ToList(); } return(View()); }
public ActionResult Rates() { using (var mo = new Models.Hotel_Amazonian_WillowEntities()) { ViewData["Tarifas"] = mo.Tipo_Habitacion.Include(p => p.Imagen1).Include(p => p.Caracteristica).ToList(); } return(View()); }
public ActionResult Facilities() { using (var mo = new Models.Hotel_Amazonian_WillowEntities()) { ViewData["Facilities"] = mo.Pagina.Where(x => x.nombre == "Facilidades").Include(p => p.Info).Include(p => p.Info.Select(x => x.Imagen1)).ToList(); } return(View()); }
public ActionResult HowToGet() { using (var mo = new Models.Hotel_Amazonian_WillowEntities()) { ViewData["¿Como Llegar?"] = mo.Pagina.Where(x => x.nombre == "¿Como Llegar?").Include(p => p.Info).ToList(); } return(View()); }
public ActionResult CheckAvailability() { using (var mo = new Models.Hotel_Amazonian_WillowEntities()) { ViewData["types"] = mo.Tipo_Habitacion.ToList(); } return View(); }
}//makeReservation public JsonResult freeRoom(int numero) { using (var mo = new Models.Hotel_Amazonian_WillowEntities()) { mo.FreeRoom(numero); return Json("Cancelado", JsonRequestBehavior.AllowGet); } }//freeRoom
public PartialViewResult _Promotions() { using (var mo = new Models.Hotel_Amazonian_WillowEntities()) { DateTime fechaActual = DateTime.Today; ViewData["Promotions"] = mo.Promocion.Where(p => p.inicio <= fechaActual && p.fin >= fechaActual).Include(p => p.Tipo_Habitacion).Include(p => p.Tipo_Habitacion.Imagen1).ToList(); } return(PartialView()); }
public ActionResult InsertFacilitie() { using (var mo = new Models.Hotel_Amazonian_WillowEntities()) { ViewData["Status"] = new SelectList(mo.Estado.ToList(), "Id_Estado", "Nombre"); } //ViewData["Status"] = new SelectList(model.getStatus(), "Id_Estado", "Nombre"); ; return(View()); }
public JsonResult consultarDisponibilidad(int TipoHabitacion, String fechaLlegada, String fechaSalida) { var mo = new Models.Hotel_Amazonian_WillowEntities(); DateTime llegada = DateTime.Parse(fechaLlegada); DateTime salida = DateTime.Parse(fechaSalida); return Json(mo.CheckRoomsAvailable(llegada, salida, TipoHabitacion), JsonRequestBehavior.AllowGet); }
public ActionResult About() { ViewBag.Message = "Informate más de las atracciones que existen cerca del hotel"; using (var mo = new Models.Hotel_Amazonian_WillowEntities()) { ViewData["SobreNosotros"] = mo.Pagina.Where(x => x.nombre == "Sobre Nosotros").Include(p => p.Info).Include(p => p.Info.Select(x => x.Imagen1)).ToList(); } return(View()); }
}//RoomNotAvailable public JsonResult checkAvailability(int TipoHabitacion, String fechaLlegada, String fechaSalida) { using (var mo = new Models.Hotel_Amazonian_WillowEntities()) { DateTime fechaLlegada1 = DateTime.Parse(fechaLlegada); DateTime fechaSalida1 = DateTime.Parse(fechaSalida); ObjectResult<Models.CheckAvailability_Result> result = mo.CheckAvailability(TipoHabitacion, fechaLlegada1, fechaSalida1); Models.CheckAvailability_Result checkAvailability1 = new Models.CheckAvailability_Result(); foreach (Models.CheckAvailability_Result checkAvailability in result) checkAvailability1 = checkAvailability; Thread.Sleep(3000); return Json(checkAvailability1, JsonRequestBehavior.AllowGet); } }//checkAvailability
}//checkAvailability public JsonResult makeReservation(String identificacion, String nombre, String apellidos, String correo, String tarjeta, String fechaV, String codigoS, int numero, String fechaLlegada, String fechaSalida, float monto) { using (var mo = new Models.Hotel_Amazonian_WillowEntities()) { DateTime fechaLlegada1 = DateTime.Parse(fechaLlegada); DateTime fechaSalida1 = DateTime.Parse(fechaSalida); ObjectResult<Models.MakeReservation_Result> result = mo.MakeReservation(identificacion, nombre, apellidos, correo, tarjeta, fechaV, codigoS,numero, fechaLlegada1, fechaSalida1, monto); Models.MakeReservation_Result makeReservation1 = new Models.MakeReservation_Result(); foreach (Models.MakeReservation_Result makeReservation in result) makeReservation1 = makeReservation; Thread.Sleep(3000); return Json(makeReservation1, JsonRequestBehavior.AllowGet); } }//makeReservation
}//OnlineBook public ActionResult ReservationClient(int numero, String titulo, String descripcion, double tarifa, int imagen, String fechaLlegada, String fechaSalida) { Models.CheckAvailability_Result checkAvailability = new Models.CheckAvailability_Result(); checkAvailability.numero = numero; checkAvailability.titulo = titulo; checkAvailability.descripcion = descripcion; checkAvailability.tarifa = tarifa; checkAvailability.imagen = imagen; ViewData["fechaLlegada"] = fechaLlegada; ViewData["fechaSalida"] = fechaSalida; ViewData["Monto"] = tarifa * calcularDias(fechaLlegada, fechaSalida); using (var mo = new Models.Hotel_Amazonian_WillowEntities()) { ViewData["imagen"] = mo.Imagen.Where(x => x.id_Imagen == imagen).ToList(); } return View(checkAvailability); }//ReservationClient
}//end method public JsonResult updatePromotion(int id,string comment, int idescuento, DateTime iFechaInicio, DateTime iFechaFinal, int tipo) { if (comment != null && idescuento != 0 && tipo != 0 && iFechaFinal != null && iFechaInicio != null) { var mo = new Models.Hotel_Amazonian_WillowEntities(); var promo = mo.Promocion.Where(d => d.id == id).First(); promo.id = id; promo.inicio = iFechaInicio; promo.descripcion = comment; promo.fin= iFechaFinal; promo.tipoHabitacion = tipo; promo.descuento = idescuento; mo.SaveChanges(); return Json("OK", JsonRequestBehavior.AllowGet); }//end validation nulls return Json("ERROR", JsonRequestBehavior.AllowGet); }//end method
public JsonResult insertPromotion(string comment, int idescuento, DateTime iFechaInicio, DateTime iFechaFinal, int tipo) { if (comment != null && idescuento != 0 && tipo != 0 && iFechaFinal != null && iFechaInicio != null) { var mo = new Models.Hotel_Amazonian_WillowEntities(); mo.Promocion.Add(new Models.Promocion { descripcion = comment, descuento = idescuento, inicio = iFechaInicio, fin = iFechaFinal, tipoHabitacion = tipo }); mo.SaveChanges(); return Json("OK", JsonRequestBehavior.AllowGet); }//end validation nulls return Json("ERROR", JsonRequestBehavior.AllowGet); }//end method
public JsonResult getOnePromotion(int id) { var mo = new Models.Hotel_Amazonian_WillowEntities(); return Json(mo.sp_getPromotion(id), JsonRequestBehavior.AllowGet); }
public JsonResult DeletePromotion(int id) { var mo = new Models.Hotel_Amazonian_WillowEntities(); mo.sp_deletePromotion(id); return Json("Eliminado", JsonRequestBehavior.AllowGet); }
public JsonResult getTypes() { var mo = new Models.Hotel_Amazonian_WillowEntities(); return(Json(mo.sp_getTypes(), JsonRequestBehavior.AllowGet)); }
public JsonResult getAvailableDay() { var mo = new Models.Hotel_Amazonian_WillowEntities(); return Json(mo.getRoomsDay(), JsonRequestBehavior.AllowGet); }