public ActionResult Create(CentroAtencionModel CentroAtencion) { try { CentroAtencionCollection.InsertOne(CentroAtencion); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Delete(string id, CentroAtencionModel CentroAtencion) { try { CentroAtencionCollection.DeleteOne(Builders <CentroAtencionModel> .Filter.Eq("_id", ObjectId.Parse(id))); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(string id, CentroAtencionModel CentroAtencion) { try { var filter = Builders <CentroAtencionModel> .Filter.Eq("id_", ObjectId.Parse(id)); var update = Builders <CentroAtencionModel> .Update.Set("Nombre", CentroAtencion.Nombre);//Se puede agregar mas haciendo un .Set("",) extra var result = CentroAtencionCollection.UpdateOne(filter, update); return(RedirectToAction("Index")); } catch { return(View()); } }