public void NombreRepetido(EntGolden e) { DatGolden datos = new DatGolden(); DataTable Dt = datos.NombreRepetido(e.Nombre); if (Dt.Rows.Count > 0) { throw new ApplicationException(e.Nombre + " ya tiene agendada una cita! "); } }
public void Agregar(EntGolden e) { DatGolden datos = new DatGolden(); int filas = datos.Agregar(e.Nombre, e.Email, e.Telefono); if (filas != 1) { throw new ApplicationException("Error al agregar"); } }
public ActionResult Create(EntGolden e) { try { BusGolden bus = new BusGolden(); bus.NombreRepetido(e); bus.Agregar(e); TempData["msj"] = "Tu cita esta confirmada " + e.Nombre; return(View("Index")); } catch (Exception ex) { TempData["error"] = ex.Message; return(View("Index")); } }