Beispiel #1
0
        public CommandResponse RemoverCusta(long IdEstado)
        {
            try
            {
                using (_context.Connection)
                {
                    _context.GetConnection();
                    _context.Connection.Execute(CustasQueries.DeleteCustas(IdEstado));

                    return(new CommandResponse(true, $"Custa Removida com sucesso"));
                }
            }
            catch (SQLiteException ex)
            {
                return(new CommandResponse(false, $"Erro : {ex.Message}"));
            }
        }
Beispiel #2
0
        public CommandResponse EditarCusta(EstadosVsCustas custa)
        {
            try
            {
                using (_context.Connection)
                {
                    _context.GetConnection();
                    _context.Connection.Execute(CustasQueries.UpdateCustas(custa));

                    return(new CommandResponse(true, $"Custa Atualizada com sucesso"));
                }
            }
            catch (SQLiteException ex)
            {
                return(new CommandResponse(true, $"Erro : {ex.Message}"));
            }
        }
Beispiel #3
0
 public IEnumerable <CustasQueryResult> ObterTodosDetalhado()
 {
     try
     {
         using (_context.Connection)
         {
             _context.GetConnection();
             return(_context
                    .Connection
                    .Query <CustasQueryResult>(CustasQueries.SelectCustasDetalhado(), new { }));
         }
     }
     catch (SQLiteException ex)
     {
         throw ex;
     }
 }
Beispiel #4
0
        public CommandResponse AdicionarCusta(EstadosVsCustas custa)
        {
            try
            {
                using (_context.Connection)
                {
                    _context.GetConnection();

                    var param = new DynamicParameters();
                    param.Add(name: "IdEstado", value: custa.IdEstado, direction: System.Data.ParameterDirection.Input);
                    param.Add(name: "De", value: custa.De, direction: System.Data.ParameterDirection.Input);
                    param.Add(name: "Ate", value: custa.Ate, direction: System.Data.ParameterDirection.Input);

                    _context.Connection.Execute(CustasQueries.InsertCustas(), param);

                    return(new CommandResponse(true, $"Custa adicionada com sucesso"));
                }
            }
            catch (SQLiteException ex)
            {
                return(new CommandResponse(false, $"Erro : {ex.Message}"));
            }
        }