Exemplo n.º 1
0
        public async Task <string> Post(GSE model)
        {
            try {
                _dataContext.GSEs.Add(model);
                await _dataContext.SaveChangesAsync();

                return("Realizado");
            }
            catch (Exception error)
            {
                return(error.ToString());
            }
        }
Exemplo n.º 2
0
        public async Task <string> Put(GSE model)
        {
            try
            {
                _dataContext.GSEs.Update(model);
                await _dataContext.SaveChangesAsync();

                return("Realizado");
            }
            catch (DbUpdateConcurrencyException)
            {
                return("Item esta sendo atualizado neste momento, tente mais tarde");
            }
            catch (Exception error)
            {
                return(error.ToString());
            }
        }
Exemplo n.º 3
0
        public async Task <string> Delete(GSE model)
        {
            try {
                var item = _dataContext.GSEs.Find(model.id);

                if (item == null)
                {
                    return("Não encontrado");
                }

                _dataContext.GSEs.Remove(item);
                await _dataContext.SaveChangesAsync();

                return("Realizado");
            }
            catch (Exception error)
            {
                return(error.ToString());
            }
        }
Exemplo n.º 4
0
 public Task <string> Put(GSE model)
 {
     return(_repository.Put(model));
 }
Exemplo n.º 5
0
 public Task <string> Delete(GSE model)
 {
     return(_repository.Delete(model));
 }
Exemplo n.º 6
0
        public async Task <ActionResult <string> > Delete(GSE model)
        {
            var resp = await _services.Delete(model);

            return(Ok(resp));
        }