Example #1
0
        public async Task <IActionResult> Crear([FromBody] List <CrearViewModel> model)
        {
            List <ListaPrecioDetalle> listasPrecioDetalles = new List <ListaPrecioDetalle>();

            model.ForEach(lista =>
            {
                ListaPrecioDetalle lpd = new ListaPrecioDetalle
                {
                    LipId        = lista.LipId,
                    ProId        = lista.ProId,
                    LipDetSinIva = lista.LipDetSinIva,
                    LipDetConIva = lista.LipDetConIva
                };
                listasPrecioDetalles.Add(lpd);
            });

            await _context.ListaPrecioDetalles.AddRangeAsync(listasPrecioDetalles);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }

            return(Ok());
        }
Example #2
0
 public IActionResult Update(int IdListD, [FromBody] ListaPrecioDetalle entity)
 {
     try
     {
         listaPrecioDetalleBusiness.Update(IdListD, entity);
         return(Ok("Ok"));
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Example #3
0
 public IActionResult Create([FromBody] ListaPrecioDetalle entity)
 {
     try
     {
         listaPrecioDetalleBusiness.Create(entity);
         return(Ok("Ok"));
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Example #4
0
 public void Create(ListaPrecioDetalle entity)
 {
     try
     {
         SiinErpContext context = new SiinErpContext();
         context.ListaPreciosDetalles.Add(entity);
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         errorBusiness.Create("CreateListaPrecioDetalle", ex.Message, null);
         throw;
     }
 }
Example #5
0
 public void Delete(int IdListaPrecioDetalle)
 {
     try
     {
         SiinErpContext     context = new SiinErpContext();
         ListaPrecioDetalle entity  = context.ListaPreciosDetalles.Find(IdListaPrecioDetalle);
         context.ListaPreciosDetalles.Remove(entity);
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         errorBusiness.Create("DeleteListaPrecioDetalle", ex.Message, null);
         throw;
     }
 }
Example #6
0
 public void Update(int IdListaPrecioDetalle, ListaPrecioDetalle entity)
 {
     try
     {
         SiinErpContext     context = new SiinErpContext();
         ListaPrecioDetalle ob      = context.ListaPreciosDetalles.Find(IdListaPrecioDetalle);
         ob.IdArticulo = entity.IdArticulo;
         ob.VrUnitario = entity.VrUnitario;
         ob.PcDscto    = entity.PcDscto;
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         errorBusiness.Create("UpdateListaPrecioDetalle", ex.Message, null);
         throw;
     }
 }