public async Task <IActionResult> GetGoodsDeliveredLineById(Int64 GoodsDeliveredLineId)
        {
            GoodsDeliveredLine Items = new GoodsDeliveredLine();

            try
            {
                Items = await _context.GoodsDeliveredLine.Where(q => q.GoodsDeliveredLinedId == GoodsDeliveredLineId).FirstOrDefaultAsync();
            }
            catch (Exception ex)
            {
                _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                return(BadRequest($"Ocurrio un error:{ex.Message}"));
            }


            return(await Task.Run(() => Ok(Items)));
        }
        public async Task <ActionResult <GoodsDeliveredLine> > Insert([FromBody] GoodsDeliveredLine _GoodsDeliveredLine)
        {
            GoodsDeliveredLine _GoodsDeliveredLineq = new GoodsDeliveredLine();

            try
            {
                _GoodsDeliveredLineq = _GoodsDeliveredLine;
                _context.GoodsDeliveredLine.Add(_GoodsDeliveredLineq);
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                return(BadRequest($"Ocurrio un error:{ex.Message}"));
            }

            return(await Task.Run(() => Ok(_GoodsDeliveredLineq)));
        }
        public async Task <IActionResult> Delete([FromBody] GoodsDeliveredLine _GoodsDeliveredLine)
        {
            GoodsDeliveredLine _GoodsDeliveredLineq = new GoodsDeliveredLine();

            try
            {
                _GoodsDeliveredLineq = _context.GoodsDeliveredLine
                                       .Where(x => x.GoodsDeliveredLinedId == (Int64)_GoodsDeliveredLine.GoodsDeliveredLinedId)
                                       .FirstOrDefault();

                _context.GoodsDeliveredLine.Remove(_GoodsDeliveredLineq);
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                return(BadRequest($"Ocurrio un error:{ex.Message}"));
            }

            return(await Task.Run(() => Ok(_GoodsDeliveredLineq)));
        }
        public async Task <ActionResult <GoodsDeliveredLine> > Update([FromBody] GoodsDeliveredLine _GoodsDeliveredLine)
        {
            GoodsDeliveredLine _GoodsDeliveredLineq = _GoodsDeliveredLine;

            try
            {
                _GoodsDeliveredLineq = await(from c in _context.GoodsDeliveredLine
                                             .Where(q => q.GoodsDeliveredLinedId == _GoodsDeliveredLine.GoodsDeliveredLinedId)
                                             select c
                                             ).FirstOrDefaultAsync();

                _context.Entry(_GoodsDeliveredLineq).CurrentValues.SetValues((_GoodsDeliveredLine));

                //_context.GoodsDeliveredLine.Update(_GoodsDeliveredLineq);
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                return(BadRequest($"Ocurrio un error:{ex.Message}"));
            }

            return(await Task.Run(() => Ok(_GoodsDeliveredLineq)));
        }