Exemple #1
0
        public ICollection <ItemBO> Get()
        {
            var Catlist = _category.Get();

            Catlist.ForEach((cat) =>
            {
                int i = 0;
                while (i < 10)
                {
                    _item.Create(new ItemBO {
                        BarCode = "1234568789", CategoryId = cat.Id, Name = "Item Name " + i
                    });
                    i += 1;
                }
            });
            return(_item.Get().ToList());
        }
        public async Task <ActionResult <ItemDTO> > PostItem(ItemDTO item)
        {
            await _item.Create(item);

            await _log.CreateLog(HttpContext, User.FindFirst("UserName").Value);

            return(CreatedAtAction("GetItem", new { id = item.Id }, item));
        }
Exemple #3
0
 private void Start()
 {
     MarketPlace[] marketPlaces = { new BottomMarket("Bottom"), new TopMarket("Top") };
     foreach (MarketPlace marketplace in marketPlaces)
     {
         IItem item = marketplace.Craft();
         Debug.Log(item.Create());
     }
 }
Exemple #4
0
        public async Task <IActionResult> Create(ItemDTO item)
        {
            if (ModelState.IsValid)
            {
                await _item.Create(item);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(item));
        }
        public ActionResult Create(ItemCreateDto itemCreateDto)
        {
            var itemModel = _mapper.Map <Item>(itemCreateDto);

            _itemService.Create(itemModel);
            _itemService.SaveChanges();
            var itemReadFullDto = _mapper.Map <ItemReadFullDto>(itemModel);

            return(CreatedAtRoute(nameof(GetItem), new { id = itemReadFullDto.Id }, itemReadFullDto));
        }
        public ActionResult Create(ItemInput input)
        {
            var userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier)?.Value;

            var item = new Item
            {
                UserId      = userId,
                Title       = input.Title,
                Description = input.Description,
                IsDone      = input.IsDone
            };

            item.Id = _itemService.Create(item);
            return(CreatedAtRoute("GetItem", new { id = item.Id }, item));
        }