示例#1
0
        public ActionResult ItemMenu()
        {
            var repo  = new ItemTypeRepository();
            var model = repo.GetListForCustomer(this.CurrentRegionInfo.CurrentLanguage);

            return(PartialView("_ItemMenu", model));
        }
        public ReturnValueModel CreateNewItem(ItemViewModel newItem, int userId)
        {
            var rv = new ReturnValueModel();

            newItem.LifeSpan = newItem.LifeSpan == 0 ? 5 : newItem.LifeSpan;

            var newItemId = itemRepostory.Insert(newItem, userId);


            var catRepo     = new ItemTypeRepository();
            var itemType    = catRepo.QueryItemType(newItem.TypeId);
            var itemSubtype = catSubRepository.QuerySubTypeById(newItem.SubTypeId);


            var assetTag = GenerateAssetTag(itemType.Name, itemSubtype.Name, newItemId);

            rv.Success = itemRepostory.AttachAssetTag(newItemId, assetTag);
            if (rv.Success)
            {
                rv.Param1 = newItemId.ToString();
                rv.Param2 = assetTag;
            }

            return(rv);
        }
        public void SaveItemType()
        {
            var itemTypeRepository = new ItemTypeRepository();
            var api = new ItemTypesController(itemTypeRepository);

            var postResponse = api.PostItemType(new ItemTypeDto {
                Code = "fruit"
            });
            var postResponseStatusCode = (postResponse as ObjectResult).StatusCode;

            Assert.Equal((int)HttpStatusCode.Created, postResponseStatusCode);
        }
        public void GetItemType()
        {
            var itemTypeRepository = new ItemTypeRepository();
            var api = new ItemTypesController(itemTypeRepository);

            var postResponse = api.PostItemType(new ItemTypeDto {
                Code = "fruit"
            });
            var postResponseStatusCode = (postResponse as ObjectResult).StatusCode;

            Assert.Equal((int)HttpStatusCode.Created, postResponseStatusCode);

            var getResponse = api.GetItemType("fruit");
            var statusCode  = (getResponse as ObjectResult).StatusCode;

            Assert.Equal((int)HttpStatusCode.OK, statusCode);
            Assert.Equal("fruit", ((getResponse as ObjectResult).Value as ItemType).Code);
        }
        public void GetItemTypeAllItemTypes()
        {
            var itemTypeRepository = new ItemTypeRepository();
            var api = new ItemTypesController(itemTypeRepository);

            var postResponse = api.PostItemType(new ItemTypeDto {
                Code = "fruit"
            });
            var postResponseStatusCode = (postResponse as ObjectResult).StatusCode;

            Assert.Equal((int)HttpStatusCode.Created, postResponseStatusCode);

            var getResponse = api.GetAll();
            var statusCode  = (getResponse as ObjectResult).StatusCode;

            Assert.Equal((int)HttpStatusCode.OK, statusCode);
            Assert.Single((IEnumerable)(getResponse as ObjectResult).Value);
        }
 public ItemModel()
 {
     catRepository    = new ItemTypeRepository();
     itemRepostory    = new ItemRepository();
     catSubRepository = new ItemSubTypeRepository();
 }
 private readonly ItemTypeRepository itemTypeRepository; // table
 public ItemTypeBusiness(IInventoryUnitOfWork inventoryDb)
 {
     this._inventoryDb  = inventoryDb;
     itemTypeRepository = new ItemTypeRepository(this._inventoryDb);
 }
 public ItemTypeModel()
 {
     itemTypeRepository = new ItemTypeRepository();
 }
示例#9
0
 public ItemTypesController(ApplicationDbContext context)
 {
     repository = new ItemTypeRepository(context);
 }
示例#10
0
 public SearchController(ApplicationDbContext context)
 {
     repository     = new ItemRepository(context);
     repositoryType = new ItemTypeRepository(context);
 }
 public ItemTypeRepositoryTests()
 {
     itemType           = CreateNewItemType();
     itemTypeRepository = GetInMemoryItemTypeRepository();
 }
示例#12
0
 public ItemsController(ItemTypeRepository itemTypeRepository, ItemRepository itemRepository)
 {
     _itemTypeRepository = itemTypeRepository;
     _itemRepository     = itemRepository;
 }
示例#13
0
 public ItemsController(ApplicationDbContext context)
 {
     repository       = new ItemRepository(context);
     typeRepository   = new ItemTypeRepository(context);
     authorRepository = new AuthorRepository(context);
 }