Esempio n. 1
0
        public async Task <CheckSaleResponseModel> CheckSaleAsync(CheckSaleModel model)
        {
            if (model == null || string.IsNullOrWhiteSpace(model.SaleCode))
            {
                return(ToResponse <CheckSaleResponseModel>(null, Errors.invalid_data));
            }
            var result = await _svMcredit.CheckSale(model.SaleCode);

            if (!result.success)
            {
                return(ToResponse <CheckSaleResponseModel>(null, result.error));
            }
            if (model.ProfileId > 0)
            {
                if (result.success && result.data.obj != null)
                {
                    var sale = _mapper.Map <UpdateSaleModel>(result.data.obj);
                    await _rpMCredit.UpdateSaleAsyncAsync(sale, model.ProfileId);
                }
                return(result.data);
            }
            if (result.success)
            {
                return(result.data);
            }
            return(ToResponse <CheckSaleResponseModel>(null, result.data.msg.ToString()));
        }
Esempio n. 2
0
        public async Task <IActionResult> CheckSaleApi([FromBody] CheckSaleModel model)
        {
            var result = await _bizMCredit.CheckSaleAsync(model);

            return(ToResponse(result));
        }