public ActionResult DeleteConfirmed(Cita cita) { var p = new CitaApiProcess(); //Cita cita = p.ReadBy(id); p.Delete(cita); return(RedirectToAction("Index")); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var p = new CitaApiProcess(); Cita cita = p.ReadBy(id.Value); if (cita == null) { return(HttpNotFound()); } return(View(cita)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var p = new CitaApiProcess(); Cita cita = p.ReadBy(id.Value); SelectList list = new SelectList(cita.TipoEstado); ViewData["ListaEstados"] = list; if (cita == null) { return(HttpNotFound()); } return(View(cita)); }
public ActionResult Create(Cita cita) { try { var p = new CitaApiProcess(); var existeTurno = p.ToList().Where(x => x.Fecha == cita.Fecha).FirstOrDefault(); if (existeTurno == null) { p.Add(cita); TempData["MessageViewBagName"] = new GenericMessageViewModel { Message = "Registro agregado a la base de datos.", MessageType = GenericMessages.success }; return(RedirectToAction("Index")); } else { TempData["MessageViewBagName"] = new GenericMessageViewModel { Message = "Horario NO disponible", MessageType = GenericMessages.danger, ConstantMessage = true }; return(View(cita)); } } catch (Exception ex) { TempData["MessageViewBagName"] = new GenericMessageViewModel { Message = ex.Message, MessageType = GenericMessages.danger, ConstantMessage = true }; return(View(cita)); } }
public JsonResult GetEvents(DateTime start, DateTime end) { //var viewModel = new CitaViewModel(); var events = new List <object>(); var citas = new CitaApiProcess().ToList(); foreach (var c in citas) { var paciente = new PacienteApiProcess().ReadBy(c.PacienteId); var cliente = new ClienteApiProcess().ReadBy(paciente.ClienteId); events.Add(new CitaViewModel() { id = c.Id, title = cliente.Apellido.ToString(), start = c.Fecha.AddDays(1).AddHours(-5).ToString("yyyy-MM-dd hh:mm "), //end = c.Fecha.AddHours(-5).AddMinutes(30).ToString("yyyy-MM-dd hh:mm"), allDay = false }); } return(Json(events.ToArray(), JsonRequestBehavior.AllowGet)); }
public ActionResult Index() { var p = new CitaApiProcess(); return(View(p.ToList())); }