Esempio n. 1
0
        public static IngresoEntidad Map(CrearIngresoDTO ingresoDTO)
        {
            IngresoEntidad ingreso = new IngresoEntidad();
            List <DetalleIngresoEntidad> lstDetalle = new List <DetalleIngresoEntidad>();

            if (ingresoDTO != null)
            {
                ingreso.PersonasId       = ingresoDTO.PersonaId;
                ingreso.TipoComprobante  = ingresoDTO.TipoComprobante;
                ingreso.SerieComprobante = ingresoDTO.SerieComprobante;
                ingreso.Impuesto         = ingresoDTO.Impuesto;
                ingreso.Total            = ingresoDTO.Total;
                ingreso.Estatus          = "Act";

                if (ingresoDTO.Detalles != null)
                {
                    foreach (var item in ingresoDTO.Detalles)
                    {
                        lstDetalle.Add(
                            new DetalleIngresoEntidad
                        {
                            ProductosId = item.ProductoId,
                            Cantidad    = item.Cantidad,
                            Precio      = item.Precio
                        }
                            );
                    }
                }

                ingreso.DetalleIngresos = lstDetalle;
            }

            return(ingreso);
        }
        public async Task <IngresoEntidad> CrearIngresoDetalle(IngresoEntidad ingreso)
        {
            ingreso.UsuariosId = _context.UsuarioAutenticado();

            await _context.Ingresos.AddAsync(ingreso);

            return(await _context.SaveChangesAsync() > 0 ? ingreso : null);
        }
Esempio n. 3
0
        public static IngresosDTO Map(IngresoEntidad ingreso)
        {
            IngresosDTO ingresoDTO = new IngresosDTO();

            if (ingresoDTO != null)
            {
                ingresoDTO.Id = ingreso.Id;
                ingresoDTO.TipoComprobante  = ingreso.TipoComprobante;
                ingresoDTO.SerieComprobante = ingreso.SerieComprobante;
                ingresoDTO.Impuesto         = ingreso.Impuesto;
                ingresoDTO.Total            = ingreso.Total;
                ingresoDTO.Estatus          = ingreso.Estatus;
            }

            return(ingresoDTO);
        }
Esempio n. 4
0
 public async Task <IngresoEntidad> CrearIngresoDetalle(IngresoEntidad ingreso)
 {
     return(await _ingresoRepositorio.CrearIngresoDetalle(ingreso));
 }
        public async Task <bool> EliminarIngresoAsync(IngresoEntidad ingreso)
        {
            _context.Ingresos.Remove(ingreso);

            return(await _context.SaveChangesAsync() > 0 ? true : false);
        }
        public async Task <bool> ActualizarIngresoAsync(IngresoEntidad ingreso)
        {
            _context.Ingresos.Update(ingreso);

            return(await _context.SaveChangesAsync() > 0 ? true : false);
        }