public IActionResult Create([FromBody] InteresadosEventos item) { try { if (item == null) { return(BadRequest()); } _repo.Add(item); //TODO: si el item es null, genera un error QUE NO ES CAPTURADO ¿????? return(CreatedAtRoute("GetInteresadosEventos", new { controller = "InteresadosEventos", Id = item.Id }, item)); } catch (System.Exception ex) { return(Utils.ResponseInternalError(ex)); } }
public void Update(InteresadosEventos item) { try { using (var db = new escuelapsdelsurContext()) { db.Update(item); db.SaveChanges(); _logger.LogInformation("Actualizar InteresadoEvento ID: " + item.Id.ToString() + " --> OK"); } } catch (System.Exception ex) { _logger.LogError(ex.Message); throw ex; } }
public void Add(InteresadosEventos item) { try { using (var db = new escuelapsdelsurContext()) { db.InteresadosEventos.Add(item); db.SaveChanges(); _logger.LogInformation("Crear InteresadoEvento (" + item.Id.ToString() + ") --> Ok"); } } catch (System.Exception ex) { _logger.LogError(ex.Message); throw ex; } }
public InteresadosEventos Find(int id) { InteresadosEventos item = null; try { using (var db = new escuelapsdelsurContext()) { item = db.InteresadosEventos.Find(id); _logger.LogInformation("Buscar InteresadoEventoId: " + id.ToString() + " --> OK"); } } catch (System.Exception ex) { _logger.LogError(ex.Message); throw ex; } return(item); }
public IActionResult Put([FromBody] InteresadosEventos item) { try { if (item == null) { return(BadRequest()); } if (_repo.Find(item.Id) == null) { return(NotFound()); } _repo.Update(item); return(NoContent()); } catch (System.Exception ex) { return(Utils.ResponseInternalError(ex)); } }