// GET: Parcela public async Task <IActionResult> Index() { var controleFaturamentoContext = _context.Parcelas.Include(p => p.Fatura).AsNoTracking() .OrderBy(p => p.Vencimento.Date.Day) .OrderBy(p => p.Vencimento.Date.Month) .OrderBy(p => p.Vencimento.Date.Year) ; List <Parcela> parcelasVencidas = _context.Parcelas.ToList(); foreach (Parcela p in parcelasVencidas) { if (p.Vencimento < DateTime.Now && p.Status.Equals(StatusEnum.Pagamento.Pendente.ToString())) { p.Status = StatusEnum.Pagamento.Vencido.ToString(); _context.Update(p); await _context.SaveChangesAsync(); } } //_context.SaveChangesAsync(); return(View(await controleFaturamentoContext.ToListAsync())); }
public async Task <IActionResult> Edit(int id, [Bind("ID,TipoCustoID,Valor,Data,Observacao")] Despesa despesa) { if (id != despesa.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(despesa); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DespesaExists(despesa.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["TipoCustoID"] = new SelectList(_context.Set <TipoCusto>(), "ID", "ID", despesa.TipoCustoID); return(View(despesa)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,DataEmissao,Tipo,Numero,NumeroParcelas,ValorFatura,Observacao,ClienteID")] Fatura fatura) { if (id != fatura.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(fatura); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FaturaExists(fatura.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ClienteID"] = new SelectList(_context.Clientes, "ID", "ID", fatura.ClienteID); return(View(fatura)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Pis,Confins,Fgts,Inss,ComissaoVendedor,Icms,FreteVenda,FreteCompra,ProducaoMensal")] VariaveisDeCalculo variaveisDeCalculo) { if (id != variaveisDeCalculo.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(variaveisDeCalculo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VariaveisDeCalculoExists(variaveisDeCalculo.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(variaveisDeCalculo)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Data,Quantidade,Tipo,Peso")] Producao producao) { if (id != producao.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(producao); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProducaoExists(producao.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(producao)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Nome")] TipoCusto tipoCusto) { if (id != tipoCusto.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tipoCusto); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TipoCustoExists(tipoCusto.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tipoCusto)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Peso,Trigo,Embalagem,Caixa,Folha,Vitamina,Lecitina,Fita,Bandeja,Energia,Lenha,Manutenção,PorcentagemVendedor,PorcentagemLucro,CustoFixo")] PrecoCusto precoCusto) { if (id != precoCusto.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(precoCusto); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PrecoCustoExists(precoCusto.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(precoCusto)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,DataAdimissao,Salario,Ativo")] Funcionario funcionario) { if (id != funcionario.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(funcionario); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FuncionarioExists(funcionario.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(funcionario)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Documento,NumeroDocumento,Nome,Telefone")] Cliente cliente) { if (id != cliente.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cliente); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClienteExists(cliente.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(cliente)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Estado,Cidade,Bairro,Rua,Numero,Cep")] Endereco endereco) { if (id != endereco.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(endereco); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EnderecoExists(endereco.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(endereco)); }