public async Task Create(Fortalezas model) { try { _db.fortalezas.Add(model); await _db.SaveChangesAsync(); } catch (Exception e) { throw new Exception(e.Message, e); } }
public async Task Update(Fortalezas model) { try { var _model = await _db.fortalezas.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); } }