public async Task <bool> UpdateEditorial(EditorialBean model) { var context = contexto.CrearContext(); var editorial = await context.Editorial.FirstOrDefaultAsync(u => u.id_editorial == model.id); if (editorial == null) { return(false); } editorial.nombre = model.nombre; editorial.correspondencia = model.correspondencia; editorial.telefono = model.telefono; editorial.correo = model.correo; editorial.max_registros = model.max_registros; try { await context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { return(false); } return(true); }
public async Task <bool> InsertEditorial(EditorialBean model) { var context = contexto.CrearContext(); //DateTime fecha = DateTime.Now; Editorial editorial = new Editorial { nombre = model.nombre, correspondencia = model.correspondencia, telefono = model.telefono, correo = model.correo, max_registros = model.max_registros }; context.Editorial.Add(editorial); try { await context.SaveChangesAsync(); } catch (Exception) { return(false); } return(true); }
public async Task <IActionResult> Insert([FromBody] EditorialBean model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } //Insert Datos y Envio de correo var consulta = await editorialBLL.InsertEditorial(model); if (consulta == false) { return(BadRequest()); } return(Ok()); }
public async Task <IActionResult> Update([FromBody] EditorialBean model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (model.id <= 0) { return(BadRequest()); } var consulta = await editorialBLL.UpdateEditorial(model); if (consulta == true) { return(Ok()); } else { return(BadRequest()); } }
public Task <bool> UpdateEditorial(EditorialBean model) { return(editorialDal.UpdateEditorial(model)); }
public Task <bool> InsertEditorial(EditorialBean model) { return(editorialDal.InsertEditorial(model)); }