Пример #1
0
 public async Task Create(Fortalezas model)
 {
     try
     {
         _db.fortalezas.Add(model);
         await _db.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }
Пример #2
0
        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);
            }
        }