public async Task Insertar(GastoDto dto) { using (var context = new DataContext()) { var gasto = _mapper.Map <Dominio.Entidades.Gasto>(dto); await _gastoRepositorio.Create(gasto); } }
public GastoDto DeleteGasto(GastoDto gasto) { var deletedGasto = repository.SearchById(gasto.Id); repository.DeleteGasto(deletedGasto); return(gasto); }
public async Task Modificar(GastoDto dto) { using (var context = new DataContext()) { var gasto = context.Gastos.FirstOrDefault(x => x.Id == dto.Id); gasto.Monto = dto.Monto; gasto.PresupuestoId = dto.PresupuestoId; gasto.TipoGastoId = dto.TipoGastoId; await _gastoRepositorio.Update(gasto); } }
protected async override Task CrearNuevoElemento() { if (Gasto.TipoGasto != null) { Gasto.PresupuestoId = Presupuesto.Id; Gasto.TipoGastoId = Gasto.TipoGasto.Id; await Servicios.ApiProcessor.PostApi(Gasto, "Gasto/Insert"); await Inicializar(); Gasto = new GastoDto(); } }
public GastoDto AddGasto(GastoDto gasto) { repository.AddGasto(new Gasto() { Monto = gasto.Monto, Descripcion = gasto.Descripcion, ServicioId = gasto.Servicio.Id, Fecha = DateTime.ParseExact(gasto.Fecha, "dd/MM/yyyy", CultureInfo.InvariantCulture) }); return(gasto); }
public override bool Equals(object obj) { if (obj is GastoDto) { GastoDto gasto = obj as GastoDto; return(gasto.Id == Id && gasto.TipoGastoId == TipoGastoId && gasto.EstaEliminado == EstaEliminado && gasto.Monto == Monto && gasto.PresupuestoId == PresupuestoId && gasto.TipoGastoId == TipoGastoId); } else { return(false); } }
protected override void Nuevo() { base.Nuevo(); Gasto = new GastoDto(); }