public async Task <SalesOrderDetailViewModel> GetSalesOrder(string salesOrderNumber)
        {
            logger.LogInformation("GetSalesOrder called");
            var response = await salesOrderApiClient.GetSalesOrderAsync(salesOrderNumber);

            var vm = new SalesOrderDetailViewModel
            {
                SalesOrder = mapper.Map <SalesOrderViewModel>(response)
            };

            return(vm);
        }
Beispiel #2
0
        public async Task <JsonResult> CreateOrEdit(SalesOrderDetailViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(new { status = false, errors = ModelState.Errors() }));
            }

            model.ModifyDate = DateTime.Now;

            if (model.Id == null)
            {
                _unitOfWork.SalesOrderDetails.Create(_mapper.Map <SalesOrderDetail>(model));
            }
            else
            {
                _unitOfWork.SalesOrderDetails.Update(_mapper.Map <SalesOrderDetail>(model));
            }

            await _unitOfWork.SaveChangesAsync();

            return(Json(new { status = true }));
        }
Beispiel #3
0
 public override void BindTo(ViewModel viewModel)
 {
     VM = viewModel as SalesOrderDetailViewModel;
     base.BindTo(viewModel);
 }