コード例 #1
0
        public async Task <IActionResult> GetGoodsDeliveryAuthorizationLineById(Int64 GoodsDeliveryAuthorizationLineId)
        {
            GoodsDeliveryAuthorizationLine Items = new GoodsDeliveryAuthorizationLine();

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


            return(await Task.Run(() => Ok(Items)));
        }
コード例 #2
0
        public async Task <ActionResult <GoodsDeliveryAuthorizationLine> > Insert([FromBody] GoodsDeliveryAuthorizationLine _GoodsDeliveryAuthorizationLine)
        {
            GoodsDeliveryAuthorizationLine _GoodsDeliveryAuthorizationLineq = new GoodsDeliveryAuthorizationLine();

            try
            {
                _GoodsDeliveryAuthorizationLineq = _GoodsDeliveryAuthorizationLine;
                _context.GoodsDeliveryAuthorizationLine.Add(_GoodsDeliveryAuthorizationLineq);
                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(_GoodsDeliveryAuthorizationLineq)));
        }
コード例 #3
0
        public async Task <IActionResult> Delete([FromBody] GoodsDeliveryAuthorizationLine _GoodsDeliveryAuthorizationLine)
        {
            GoodsDeliveryAuthorizationLine _GoodsDeliveryAuthorizationLineq = new GoodsDeliveryAuthorizationLine();

            try
            {
                _GoodsDeliveryAuthorizationLineq = _context.GoodsDeliveryAuthorizationLine
                                                   .Where(x => x.GoodsDeliveryAuthorizationLineId == (Int64)_GoodsDeliveryAuthorizationLine.GoodsDeliveryAuthorizationLineId)
                                                   .FirstOrDefault();

                _context.GoodsDeliveryAuthorizationLine.Remove(_GoodsDeliveryAuthorizationLineq);
                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(_GoodsDeliveryAuthorizationLineq)));
        }
コード例 #4
0
        public async Task <ActionResult <GoodsDeliveryAuthorizationLine> > Update([FromBody] GoodsDeliveryAuthorizationLine _GoodsDeliveryAuthorizationLine)
        {
            GoodsDeliveryAuthorizationLine _GoodsDeliveryAuthorizationLineq = _GoodsDeliveryAuthorizationLine;

            try
            {
                _GoodsDeliveryAuthorizationLineq = await(from c in _context.GoodsDeliveryAuthorizationLine
                                                         .Where(q => q.GoodsDeliveryAuthorizationLineId == _GoodsDeliveryAuthorizationLine.GoodsDeliveryAuthorizationLineId)
                                                         select c
                                                         ).FirstOrDefaultAsync();

                _context.Entry(_GoodsDeliveryAuthorizationLineq).CurrentValues.SetValues((_GoodsDeliveryAuthorizationLine));

                //_context.GoodsDeliveryAuthorizationLine.Update(_GoodsDeliveryAuthorizationLineq);
                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(_GoodsDeliveryAuthorizationLineq)));
        }