public bool Existe(CqasTipoSangre ascqtiposangre) { bool respuesta = false; CqasTipoSangre ascqtiposangre1 = _context.CqasTipoSangre.Where(x => x.Descripcion == ascqtiposangre.Descripcion).FirstOrDefault(); if (ascqtiposangre1 != null) { respuesta = true; } return(respuesta); }
public async Task <IActionResult> Edit(string id, CqasTipoSangre ascqtiposangre) { try { if (!Existe(ascqtiposangre)) { _context.CqasTipoSangre.Update(ascqtiposangre); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(RedirectToAction("Index", new { mensaje = "El Registro ya Existe" })); } catch (Exception ex) { return(View(ascqtiposangre)); } }