/// Aquí tienen que crear el nuevo Pendiente y guardarlo public bool AgregarPendiente(PendienteItem pendiente) { /// no quitar estas dos lineas var saveResult = _context.SaveChanges(); /// Regresa cierto si solo se guardó un registro (pendiente) return(saveResult == 1); }
/// Aquí tienen que crear el nuevo Pendiente y guardarlo public bool AgregarPendiente(PendienteItem pendiente) { //se añade el pediente en la variable pendiente _context.Pendientes.Add(pendiente); /// no quitar estas dos lineas var saveResult = _context.SaveChanges(); /// Regresa cierto si solo se guardó un registro (pendiente) return(saveResult == 1); }
public IActionResult Agregar(PendienteItem nuevoPendiente) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var successful = _pendientesServices.AgregarPendiente(nuevoPendiente); if (!successful) { return(BadRequest(new { error = "No se pudo agregar." })); } return(Ok()); }
public IActionResult Agregar(PendienteItem nuevoPendiente) { Console.ListaWeb($"Hacer tarea"); Console.ListaWeb($"Listo"); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var successful = _pendientesServices.AgregarPendiente(nuevoPendiente); if (!successful) { return(BadRequest(new { error = "No se pudo agregar." })); } if (Pendiente == 1) { Console.ListaWeb(MarcarHecho); } return(Ok()); }