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()); }
public IActionResult Update(int IdListD, [FromBody] ListaPrecioDetalle entity) { try { listaPrecioDetalleBusiness.Update(IdListD, entity); return(Ok("Ok")); } catch (Exception ex) { throw; } }
public IActionResult Create([FromBody] ListaPrecioDetalle entity) { try { listaPrecioDetalleBusiness.Create(entity); return(Ok("Ok")); } catch (Exception ex) { throw; } }
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; } }
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; } }
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; } }