示例#1
0
        public ActionResult Delete(string id, CitasModel Citas)
        {
            try
            {
                CitasCollection.DeleteOne(Builders <CitasModel> .Filter.Eq("_id", ObjectId.Parse(id)));

                return(RedirectToAction("CitaPacienteAsync"));
            }
            catch
            {
                return(View());
            }
        }
示例#2
0
        public ActionResult Create(CitasModel Citas)
        {
            try
            {
                CitasCollection.InsertOne(Citas);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
示例#3
0
 public ActionResult Create(CitasModel Citas)
 {
     try
     {
         string cedula = (string)TempData["cedula2"];;
         Citas.cedula = cedula;
         Citas.Estado = "Registrada";
         CitasCollection.InsertOne(Citas);
         TempData["cedula"] = cedula;
         return(RedirectToAction("CitaPacienteAsync"));
     }
     catch
     {
         return(RedirectToAction("CitaPacienteAsync"));
     }
 }
示例#4
0
        public ActionResult Edit(string id, CitasModel Citas)
        {
            try
            {
                var filter = Builders <CitasModel> .Filter.Eq("id_", ObjectId.Parse(id));

                var update = Builders <CitasModel> .Update.Set("Especialidad", Citas.Especialidad);//Se puede agregar mas haciendo un .Set("",) extra

                var result = CitasCollection.UpdateOne(filter, update);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
示例#5
0
        public ActionResult Edit(string id, CitasModel Citas)
        {
            try
            {
                var filter = Builders <CitasModel> .Filter.Eq("_id", ObjectId.Parse(id));

                var update = Builders <CitasModel> .Update.Set("Estado", "Cancelada por paciente");

                var result = CitasCollection.UpdateOne(filter, update);
                TempData["cedula"] = Citas.cedula;
                return(RedirectToAction("CitaPacienteAsync"));
            }
            catch
            {
                return(View());
            }
        }
示例#6
0
        public async System.Threading.Tasks.Task <ActionResult> EditAsync(string id, CitasModel Citas)
        {
            try
            {
                if (Citas.Estado == "0")
                {
                    var filter = Builders <CitasModel> .Filter.Eq("_id", ObjectId.Parse(id));

                    var update = Builders <CitasModel> .Update.Set("Cedula", Citas.cedula).Set("Observacion", Citas.Observacion).Set("Estado", "Asignada");//Se puede agregar mas haciendo un .Set("",) extra

                    var result = await CitasCollection.UpdateOneAsync(filter, update);

                    // var result = CitasCollection.UpdateOne(filter, update);

                    return(RedirectToAction("SecretarioV"));
                }
                else if (Citas.Estado == "1")
                {
                    var filter = Builders <CitasModel> .Filter.Eq("_id", ObjectId.Parse(id));

                    var update = Builders <CitasModel> .Update.Set("Cedula", Citas.cedula).Set("Observacion", Citas.Observacion).Set("Estado", "Eliminada por centro medico");//Se puede agregar mas haciendo un .Set("",) extra

                    var result = await CitasCollection.UpdateOneAsync(filter, update);

                    // var result = CitasCollection.UpdateOne(filter, update);

                    return(RedirectToAction("SecretarioV"));
                }
                else
                {
                    return(View());
                }
            }
            catch
            {
                return(View());
            }
        }