Exemplo n.º 1
0
        public void TakeAction([FromBody] ViewModels.Accounting.SaleInvoice viewModel)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var mapperConfig = MapperConfig.Init();

                    mapperConfig.CreateMap <DataModels.Accounting.SaleInvoice, ViewModels.Accounting.SaleInvoice>();
                    DataModels.Accounting.SaleInvoice dataModel = viewModel.Map <DataModels.Accounting.SaleInvoice, ViewModels.Accounting.SaleInvoice>();

                    _dataService.TakeAction(dataModel, viewModel.action, viewModel.actionChoice, viewModel.actionComment);
                }
                catch (Exception ex)
                {
                    _logger.Error(PrepareExceptionMessage(MethodBase.GetCurrentMethod().Name), ex);
                    throw CreateUserException(ex);
                }
            }
            else
            {
                var errors = ModelState.Values.SelectMany(value => value.Errors).Select(error => error.ErrorMessage);
                throw CreateUserException(new OTException(OTErrors.ModelStateInvalid, true, null, errors));
            }
        }
Exemplo n.º 2
0
 public void ApproveProductReturn(ViewModels.Accounting.SaleInvoice rec)
 {
     DataModels.Accounting.SaleInvoice dmrec = rec.Map <DataModels.Accounting.SaleInvoice, ViewModels.Accounting.SaleInvoice>();
     _dataService.SendEInvoice(dmrec);
 }