public ActionResult DeleteConfirmed(int id) { tbTipoSangre tbTipoSangre = db.tbTipoSangre.Find(id); db.tbTipoSangre.Remove(tbTipoSangre); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: TipoSangre/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbTipoSangre tbTipoSangre = db.tbTipoSangre.Find(id); if (tbTipoSangre == null) { return(HttpNotFound()); } return(View(tbTipoSangre)); }
public ActionResult CambiarEstado(int codTipoSangre, bool estado, FormCollection collection) { try { // TODO: Add delete logic here tbTipoSangre cambio = (from t in db.tbTipoSangre where t.codTipoSangre == codTipoSangre select t).SingleOrDefault(); cambio.estado = estado; db.SubmitChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Editar(int codTipoSangre, FormCollection collection) { try { //TODO: Add update logic here tbTipoSangre editar = (from t in db.tbTipoSangre where t.codTipoSangre == codTipoSangre select t).SingleOrDefault(); editar.tipoSangre = collection["tipoSangre"]; db.SubmitChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create([Bind(Include = "tps_Id,tps_Descripcion,tps_UsuarioCrea,tps_FechaCrea,tps_UsuarioModifica,tps_FechaModifica")] tbTipoSangre tbTipoSangre) { string UserName = ""; try { int EmployeeID = Function.GetUser(out UserName); if (ModelState.IsValid) { IEnumerable <Object> List = null; string Msj = ""; List = db.UDP_Gral_tbTipoSangre_Insert(tbTipoSangre.tps_Descripcion, EmployeeID, Function.DatetimeNow()); foreach (UDP_Gral_tbTipoSangre_Insert_Result TipoSangre in List) { Msj = TipoSangre.MensajeError; } if (Msj.StartsWith("-1")) { Function.BitacoraErrores("TipoSangre", "CreatePost", UserName, Msj); ModelState.AddModelError("", "No se pudo insertar el registro, favor contacte al administrador."); return(View()); } if (Msj.StartsWith("-2")) { ModelState.AddModelError("", "Ya existe un Tipo de sangre con el mismo nombre."); return(View()); } else { TempData["swalfunction"] = "true"; return(RedirectToAction("Index")); } } return(View(tbTipoSangre)); } catch (Exception Ex) { Function.BitacoraErrores("TipoSangre", "CreatePost", UserName, Ex.Message.ToString()); ModelState.AddModelError("", "No se pudo insertar el registro, favor contacte al administrador."); return(View()); } return(View(tbTipoSangre)); }
public ActionResult Crear(FormCollection collection) { try { //TODO: Add insert logic here tbTipoSangre nuevo = new tbTipoSangre { tipoSangre = collection["tipoSangre"], estado = true }; db.tbTipoSangre.InsertOnSubmit(nuevo); db.SubmitChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
// GET: TipoSangre/Details/5 public ActionResult Details(int?id) { try { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbTipoSangre tbTipoSangre = db.tbTipoSangre.Find(id); if (tbTipoSangre == null) { return(HttpNotFound()); } return(View(tbTipoSangre)); } catch (Exception Ex) { return(RedirectToAction("Error500", "Home")); } }
// GET: TipoSangre/Delete/5 public ActionResult CambiarEstado(int codTipoSangre, bool estado) { tbTipoSangre cambio = (from t in db.tbTipoSangre where t.codTipoSangre == codTipoSangre select t).SingleOrDefault(); return(View(cambio)); }
// GET: TipoSangre/Editar/5 public ActionResult Editar(int codTipoSangre) { tbTipoSangre editar = (from t in db.tbTipoSangre where t.codTipoSangre == codTipoSangre select t).SingleOrDefault(); return(View(editar)); }