예제 #1
0
        public async Task <Result> UpdateOrders(IEnumerable <Order> orders)
        {
            var result = new Result();

            try
            {
                if (orders == null)
                {
                    throw new ArgumentNullException(nameof(orders));
                }
                if (orders.Count() == 0)
                {
                    throw new ArgumentOutOfRangeException(nameof(orders));
                }
                _context.UpdateRange(orders);
                await _context.SaveChangesAsync();

                result.IsCompleted = true;
            }
            catch (Exception ex)
            {
                result.Message     = _builder.Build(ex.Message, nameof(EFOrderRepository), nameof(UpdateOrders));
                result.IsCompleted = false;
            }
            return(result);
        }