예제 #1
0
 public async Task AddInventLocation(InventLocation obj)
 {
     try
     {
         _context.InventLocation.Add(obj);
         await _context.SaveChangesAsync();
     }
     catch (DbEntityValidationException e)
     {
         throw e;
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #2
0
        private async Task GenerateInventLocation(int numberOfRecords)
        {
            int lastId = _inventLocationHelper.GetLastId();
            List <InventLocation> data = new List <InventLocation>();

            for (int i = 1; i <= numberOfRecords; i++)
            {
                InventLocation obj = new InventLocation();
                obj.InventLocationId = (lastId + i).ToString();
                obj.InventSiteId     = getrandom.Next(1, 100).ToString();
                obj.Name             = _randomNames[getrandom.Next(1, 40)];
                obj.RowVersion       = BitConverter.GetBytes(GetRandomDate().Ticks);
                obj.CreateDateTime   = GetRandomDate();
                obj.UpdateDateTime   = GetRandomDate();
                obj.CreatedBy        = RandomString(5);
                obj.ModifiedBy       = RandomString(5);

                data.Add(obj);
            }

            await _inventLocationHelper.AddInventLocations(data);
        }