コード例 #1
0
        public IHttpActionResult GetTransportCounByTransporterAndRoute([FromBody] object tendersData)
        {
            WebResponseContentModel <List <TransportCountModel> > model = null;

            try
            {
                model = JsonConvert.DeserializeObject <WebResponseContentModel <List <TransportCountModel> > >(tendersData.ToString());

                if (model.Content != null)
                {
                    // Let's also create a sample background job
                    //BackgroundJob.Enqueue(() => tenderRepo.GetTransportCounByTransporterAndRoute(model.Content));
                    model.Content = tenderRepo.GetTransportCounByTransporterAndRoute(model.Content);

                    model.IsRequestSuccesful = true;
                }
                else
                {
                    model.IsRequestSuccesful = false;
                    model.ValidationError    = ValidationExceptionError.res_09;
                }
            }
            catch (Exception ex)
            {
                model.IsRequestSuccesful = false;
                model.ValidationError    = ExceptionValidationHelper.GetExceptionSource(ex);
                return(Json(model));
            }

            return(Json(model));
        }