示例#1
0
        public IHttpActionResult SetTrip(DriverRouteModel model)
        {
            //_responseProvider.SetBusinessMessage(new MessageResponse()
            //{
            //    Type = ResponseTypes.Error,
            //    Message = getResource.getMessage("CodeUsed")
            //});

            try
            {
                int ff;
                if (User != null && int.TryParse(User.Identity.GetUserId(), out ff))
                {
                    var res = _routemanager.SetDriverTrip(ff, model);
                    return(Json(_responseProvider.GenerateRouteResponse(res, "SetTrip")));
                }
                else
                {
                    return
                        (ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.Unauthorized,
                                                                     "You are unauthorized to see Info!")));
                }
            }
            catch (Exception e)
            {
                _logmanager.Log(Tag, "SetTrip", e.Message);
            }
            return(Json(_responseProvider.GenerateUnknownErrorResponse()));
        }
示例#2
0
 public IHttpActionResult DisableTrip(DriverRouteModel model)
 {
     try
     {
         int ff;
         if (User != null && int.TryParse(User.Identity.GetUserId(), out ff))
         {
             var res = _routemanager.DisableDriverTrip(ff, model);
             return(Json(_responseProvider.GenerateRouteResponse(new { IsDisabled = res }, "DisableTrip")));
         }
         else
         {
             return
                 (ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.Unauthorized,
                                                              "You are unauthorized to see Info!")));
         }
     }
     catch (Exception e)
     {
         _logmanager.Log(Tag, "DisableTrip", e.Message);
     }
     return(Json(_responseProvider.GenerateUnknownErrorResponse()));
 }