Ejemplo n.º 1
0
        public IActionResult Create(GoodsViewModel model)
        {
            var goods = new Goods(0, model.Idx, model.Name, model.GoodsCatId, model.DimensionId, model.ProviderId,
                                  model.Val, model.ValDelivered, model.Price, model.Delivery,
                                  model.ImpPeriod, model.ImpTime, model.Weight, null, null, null, 0, 0);

            _repository.Create(goods);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public ActionResult <Result <GetGoodDto> > Post([FromBody] CreateGoodDto createGoodDto)
        {
            var goodToPost = goodConverter.FromCreateDto(createGoodDto);

            var resultFromRepository = goodsRepository.Create(goodToPost);

            return(CreatedAtAction(nameof(Get), new { id = resultFromRepository.Value.Id }, new Result <GetGoodDto>
            {
                IsSuccess = resultFromRepository.IsSuccess,
                Message = resultFromRepository.Message,
                Value = resultFromRepository.Value != null
                    ? goodConverter.ToGetDto(resultFromRepository.Value)
                    : null
            }));
        }
Ejemplo n.º 3
0
 public void Handle(CreateGoodsCommand handle)
 {
     _goodsrepository.Create(new Goods
     {
         Buyprice     = handle.Buyprice,
         GoodsName    = handle.GoodsName,
         GoodsCode    = handle.GoodsCode,
         DateSave     = DateTime.Now,
         GoodsGroupId = handle.GroupId,
         GoodsTypeId  = handle.TypeId,
         GoodsUnit    = handle.GoodsUnit,
         Saleprice    = handle.Saleprice,
         UserSave     = "Admin",
     });
 }
Ejemplo n.º 4
0
        public override void Handle(CreateGoodsCommand command)
        {
            var newCustomer = goodsFactory.CreateGoods(command.Title, command.Length, command.Width, command.Weight, command.Description, command.NumberOfInventory);

            goodsRepository.Create(newCustomer);
        }