Example #1
0
        public async Task <IHttpActionResult> SetDailyServiceTrips(TripInputViewModel model)
        {
            _logger.Information("SetDailyServiceTrips model: " + JsonConvert.SerializeObject(model));

            VerityResult result = new VerityResult();

            try
            {
                result = JudgeUserIdentifyNameToVerityResult();
                if (!result.IsOk)
                {
                    return(ReturnResponseMessageResult(result, HttpStatusCode.Unauthorized));
                }

                string userId = _aspNetUsersService.QueryUser(User.Identity.Name).Id;
                result = await _putTripService.CreateOrUpdatePutTrip(model, userId);

                _logger.Information("SetDailyServiceTrips result: " + JsonConvert.SerializeObject(result));
                return(new ResponseMessageResult(
                           Request.CreateResponse(
                               HttpStatusCode.OK,
                               result
                               )));
            }
            catch (Exception ex)
            {
                _logger.Information("SetDailyServiceTrips Error: " + JsonConvert.SerializeObject(ex));

                result.IsOk    = false;
                result.Message = ex.Message.ToString();
                return(ReturnResponseMessageResult(result, HttpStatusCode.InternalServerError));

                throw ex;
            }
        }