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")); }
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 })); }
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", }); }
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); }