Пример #1
0
 public void GivenSupplyWithValidModel()
 {
     _supplyItemDto = new SupplyItemDto()
     {
         Available = true,
         Code = "Test-123",
         InStock = 20,
         Name = "Gundamdam",
         Price = 20000
     };
     AbpSession.UserId = 1;
 }
Пример #2
0
        public bool Update(SupplyItemDto supplyItem)
        {
            try
            {
                var item = _supplyItemRepository.Single(e => e.Id == supplyItem.Id);

                item.Name = supplyItem.Name ?? item.Name;
                item.InStock = supplyItem.InStock;
                item.Price = supplyItem.Price;
                item.Code = supplyItem.Code ?? item.Code;
                item.Available = supplyItem.Available;
                item.Weight = supplyItem.Weight;
                item.Description = supplyItem.Description ?? item.Description;
                item.HasImage = supplyItem.HasImage;
                item.IsPo = supplyItem.IsPO;
                item.CategoryId = supplyItem.CategoryId;
                item.AvailableUntil = supplyItem.AvailableUntil;

                _supplyItemRepository.Update(item);
                return true;
            }
            catch (Exception ex)
            {
                return false;
            }
        }
Пример #3
0
       public async Task Create(SupplyItemDto supplyItem)
       {
           try
           {
               await _supplyItemRepository.InsertAsync(new SupplyItem()
               {
                   Available = supplyItem.Available,
                   Code = supplyItem.Code,
                   InStock = supplyItem.InStock,
                   Name = supplyItem.Name,
                   Price = supplyItem.Price,
                   CreationTime = DateTime.Now,
                   CreatorUser = _userRepository.Get(AbpSession.GetUserId()),
                   CreatorUserId = AbpSession.GetUserId(),
                   Weight = supplyItem.Weight,
                   Description = supplyItem.Description,
                   IsPo = supplyItem.IsPO,
                   CategoryId = supplyItem.CategoryId,
                   AvailableUntil = supplyItem.AvailableUntil
               });
           }
           catch (Exception ex)
           {
                   
               throw ex;
           }
 
       }