public void Update(double valor, double juro, EStatusEmprestimo status) { Valor = valor; Juro = juro; Status = status; DataUpdate = DateTime.Now; }
public async Task <IEnumerable <LoanQuery> > GetLoanQuery(EStatusEmprestimo status) { using (var db = await _dB.GetConAsync()) { var query = " SELECT L.[Id] "+ " ,C.[Name] AS NameClient "+ " ,L.[Valor] "+ " ,L.[Juro] "+ " ,L.[Status] "+ " ,L.[DataCadastro] "+ " FROM [dbo].[Loan] AS L "+ " INNER JOIN Client AS C ON C.Id = L.IdClient"+ " WHERE L.Status = @Status "+ " ORDER BY DataCadastro DESC; "; var loanQueries = await db.QueryAsync <LoanQuery>(query, new { Status = status }); foreach (var item in loanQueries) { query = "SELECT COUNT(Id) FROM Parcela WHERE IdLoan =@IdLoan"; item.TotalParcelas = await db.QueryFirstOrDefaultAsync <int>(query, new { IdLoan = item.Id }); query = "SELECT COUNT(Id) FROM Parcela WHERE Status = 2 AND IdLoan = @IdLoan"; item.TotalParcelasPagas = await db.QueryFirstOrDefaultAsync <int>(query, new { IdLoan = item.Id }); } return(loanQueries); } }
public async Task <ICollection <Emprestimo> > SelecionarPorStatus(EStatusEmprestimo eStatus) { return(await _contexto.Emprestimos .AsNoTracking() .Include(x => x.Livro) .Where(x => x.Status == eStatus) .ToListAsync()); }
public async Task <int> GetTotalOrderByStatus(EStatusEmprestimo status) { using (var db = await _dB.GetConAsync()) { var query = "SELECT COUNT(Id) FROM [dbo].[Loan] WHERE Status =@Status"; return(await db.QueryFirstOrDefaultAsync <int>(query, new { Status = status })); } }
public async Task <IEnumerable <Loan> > GetAllOrderByStatus(EStatusEmprestimo status) { using (var db = await _dB.GetConAsync()) { var query = " SELECT [Id] "+ " ,[IdClient] "+ " ,[Valor] "+ " ,[Juro] "+ " ,[Status] "+ " ,[DataCadastro] "+ " ,[DataUpdate] "+ " FROM [dbo].[Loan] "+ " WHERE Status = @Status "; return(await db.QueryAsync <Loan>(query, new { Status = status })); } }