public async Task <bool> UpdateEditorial(Models.Editorial data) { bool result = false; var editorial = GetEditorial(data.Id); if (editorial != null) { editorial.Nombre = data.Nombre; _context.Editorials.Update(editorial); result = await _context.SaveChangesAsync() > 0; } return(result); }
//POST: Editorial/Edit/5 public JsonResult Editar(Models.Editorial vloEditorial) { try { var _Editorial = Mapper.Map <DATA.Editorial>(vloEditorial); if (vloMEditorial.Actualizar(_Editorial)) { return(Json("Actualizado")); } else { return(Json("Error")); } } catch (Exception ex) { return(Json(ex.Message)); } }
public async Task <bool> InsertEditorial(Models.Editorial data) { _context.Editorials.Add(data); return(await _context.SaveChangesAsync() > 0); }