public HttpResponseMessage Get(Guid uid)
        {
            try
            {
                GetPictureQuery query = new GetPictureQuery()
                {
                    MandatorUIDs         = RequestMandatorUIDs,
                    IndividualPersonUID  = uid,
                    PictureDirectoryPath = ConfigurationManager.AppSettings["PictureDirectoryPath"]
                };

                GetPictureQueryHandler handler = new GetPictureQueryHandler(query, UnityContainer);

                return(Request.CreateResponse(HttpStatusCode.Accepted, handler.Handle()));
            }
            catch (UnauthorizedAccessException e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, e));
            }
            catch (DataException e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e));
            }
            catch (FileNotFoundException e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, e));
            }
            catch (Exception e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e));
            }
        }
示例#2
0
 public GetPictureQueryHandler(GetPictureQuery query, IUnityContainer unityContainer) : base(unityContainer)
 {
     _query = query;
 }