Пример #1
0
        public void CreateOrder_Return_Ture_If_Success()
        {
            var institution = UsingDbContext(ctx => ctx.Institution.Add(InitFakeEntity.GetFakeInstitution()));
            var adminEntity = InitFakeEntity.GetFakeAdmin();

            adminEntity.InstitutionId = institution.Id;
            var      admin = UsingDbContext(ctx => ctx.Admin.Add(adminEntity));
            OrderDto order = new OrderDto()
            {
                DeliveryCharge = 1000,
                Discount       = 1000,
                OrderRef       = "1234567",
                Subtotal       = 1000,
                Timestamp      = DateTime.Now,
                Total          = 10000,
                TotalQuantity  = 100,
                UserId         = admin.UserId
            };

            var result      = _orderAppService.CreateOrder(order);
            var orderResult = UsingDbContext(ctx => ctx.Order.First());

            Assert.True(result);
            Assert.True(orderResult.Id > 0);
        }
Пример #2
0
        public async Task<IHttpActionResult> Post(OrderCreateOrUpdateDto input)
        {
            if (!ModelState.IsValid)
                return BadRequest(ModelState);

            var result = await _orderAppService.CreateOrder(input);
            return Ok(result);
        }
Пример #3
0
        public async Task <IActionResult> CrateOrder([FromBody] OrderViewModel model)
        {
            try
            {
                var result = await _orderAppService.CreateOrder(Request(ObjectMapper.Map <OrderDto>(model)));

                return(Ok(base.DtoToVm <OrderDto, OrderViewModel>(result)));
            }
            catch (Exception e)
            {
                return(await HandleException(e, model));
            }
        }
Пример #4
0
        public OrderDto CreateOrder(CreateOrderInputDto inputDto)
        {
            var order = _orderAppService.CreateOrder(inputDto);

            return(order);
        }
Пример #5
0
 public async Task <OrderDto> CreateOrder(CreateOrderDto createOrderDto)
 {
     //createOrderDto.memberId = MemberId;
     return(await _orderAppService.CreateOrder(createOrderDto));
 }