private async Task <int> CreateNewCat(AptitudesCat model) { _db.bdSetAptitudesCat.Add(model); await _db.SaveChangesAsync(); return(model.Id); }
public async Task Create(AptitudesCat model) { try { _db.bdSetAptitudesCat.Add(model); await _db.SaveChangesAsync(); } catch (Exception e) { throw new Exception(e.Message, e); } }
public async Task Update(AptitudesCat model) { try { var _model = await _db.bdSetAptitudesCat.FirstOrDefaultAsync(e => e.Id == model.Id); if (_model != null) { _db.Entry(_model).CurrentValues.SetValues(model); await _db.SaveChangesAsync(); } } catch (Exception e) { throw new Exception(e.Message, e); } }
public async Task <IHttpActionResult> Update([FromBody] AptitudesCat model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { await _entityRepo.Update(model); return(Ok("Registro actualizado exitosamente!")); } catch (Exception e) { return(InternalServerError(e)); } }