public BorrarGastosViewModel(Gastos gastos) { this.gastos = gastos; var gastosViewModel = GastosViewModel.GetInstance(); gastosViewModel.Delete(this.gastos); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Concepto,FecGasto,ForPago,Valor,EmpleadoId")] Gastos gastos) { if (id != gastos.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(gastos); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GastosExists(gastos.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EmpleadoId"] = new SelectList(_context.Empleados, "Id", "Id", gastos.EmpleadoId); return(View(gastos)); }
public void LlenarClase(Gastos g) { g.Fecha = Convert.ToDateTime(DateTime.Now.ToString("dd/MM/yyyy")); g.VendedorId = Utilidades.TOINT(VendedorIdTextBox.Text); g.Concepto = ConceptoTextBox.Text; g.Monto = Utilidades.TOINT(MontoTextBox.Text); }
protected void CreateAssociatedExpenses() { TipoGastoList tipos = TipoGastoList.GetList(false, true); Expense gasto = Gastos.NewItem(this, ECategoriaGasto.SeguroSocial); TipoGastoInfo tipo = tipos.GetItem(ModulePrincipal.GetDefaultSegurosSetting()); if (tipo.Oid == 0) { throw new iQException(Resources.Messages.NO_TIPOGASTO_SEGUROS, iQExceptionCode.INVALID_OBJECT); } gasto.OidTipo = tipo.Oid; gasto.PrevisionPago = Common.EnumFunctions.GetPrevisionPago(tipo.EFormaPago, Fecha, tipo.DiasPago); gasto = Gastos.NewItem(this, ECategoriaGasto.Impuesto); tipo = tipos.GetItem(ModulePrincipal.GetDefaultIRPFSetting()); if (tipo.Oid == 0) { throw new iQException(Resources.Messages.NO_TIPOGASTO_IRPF, iQExceptionCode.INVALID_OBJECT); } gasto.OidTipo = tipo.Oid; gasto.PrevisionPago = Common.EnumFunctions.GetPrevisionPago(tipo.EFormaPago, Fecha, tipo.DiasPago); InsertStaff(); CalculateTotal(); }
public void crearGastos() { var gastos = new Gastos { IdGasto = 1, Monto = 23.2, Descripcion = "retiro de soles", Fecha = new DateTime(2020, 5, 15), idCuenta = 1 }; var mocksession = new Mock <IGastos>(); mocksession.Setup(o => o.crearGastos(gastos)); var validadcion = new Mock <IValidar>(); validadcion.Setup(o => o.validarGastos(gastos, null)); validadcion.Setup(o => o.IsValid()).Returns(true); var controler = new GastosController(mocksession.Object, validadcion.Object); var view = controler.Crear(gastos) as RedirectToRouteResult; Assert.IsInstanceOf <RedirectToRouteResult>(view); mocksession.Verify(o => o.crearGastos(gastos), Times.Once); }
private void button9_Click(object sender, EventArgs e) { Gastos tela = new Gastos(); tela.Show(); this.Hide(); }
public async Task <ActionResult <Gastos> > PostGastos(Gastos gastos) { _context.Gastos.Add(gastos); await _context.SaveChangesAsync(); return(CreatedAtAction("GetGastos", new { id = gastos.IdGastos }, gastos)); }
public async Task <IActionResult> PutGastos(int id, Gastos gastos) { if (id != gastos.IdGastos) { return(BadRequest()); } _context.Entry(gastos).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GastosExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }