Beispiel #1
0
        public ActionResult Cancel(string id_reserva, string dia, string hora)
        {
            if (Session["Login"] == "NO LOGEADO")
            {
                return(RedirectToAction("IniciarSesion", "Account", new { id = 2 }));
            }

            Reserve re = new Reserve();

            if (re.EliminarReserva(id_reserva))
            {
                Horas ho    = new Horas();
                int   truee = 0;
                if (ho.modificarEstado(truee, dia, hora))
                {
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    //realizar un delete de reserve
                }
            }
            else
            {
            }

            return(RedirectToAction("Search", "MyReserve"));
        }
        public ActionResult Save(string rut_apo = "", string nombre_paciente = "", string rut_profesional = "", string id_servicio = "",
                                 string dia     = "", string hora = "", string descripcion = "")
        {
            if (Session["Login"] == "NO LOGEADO")
            {
                return(RedirectToAction("IniciarSesion", "Account", new { id = 1 }));
            }

            if (rut_apo != "")
            {
                //"14-06-2019 0:00:00"
                string day = dia.Substring(0, 10);

                string dd  = dia.Substring(0, 2);
                string mm  = dia.Substring(3, 2);
                string yy  = dia.Substring(8, 2);
                string hh  = hora.Substring(0, 2);
                string min = hora.Substring(3, 2);

                string id_reserva = dd + mm + yy + hh + min;

                Reserve res = new Reserve();
                res = new Reserve(nombre_paciente, rut_profesional, id_servicio, rut_apo, Convert.ToDateTime(day), descripcion, Int64.Parse(id_reserva));
                if (res.Create())
                {
                    Horas ho    = new Horas();
                    int   truee = 1;
                    if (ho.modificarEstado(truee, day, hora))
                    {
                        return(RedirectToAction("Index", "Home", new { exito = "Exito" }));
                    }
                    else
                    {
                        //realizar un delete de reserve
                    }
                }
                else
                {
                }
            }


            return(View());
        }