Example #1
0
        public IEnumerable <int> GetAll(string fotoserieKey)
        {
            //string fotoserieKey = this.FotoserieKey();

            int fotoserieId           = fotoserieRepo.FindIdForKey(fotoserieKey);
            IEnumerable <int> fotoIds = repository.GetAll(fotoserieId);

            if (fotoIds == null)
            {
                HttpResponseMessage resp = new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content      = new StringContent("Er is iets mis gegaan."),
                    ReasonPhrase = "Interne server fout"
                };
                throw new HttpResponseException(resp);
            }

            return(fotoIds);
        }
Example #2
0
 public HttpResponseMessage Get([FromUri] string[] include, [FromUri] bool indent = false)
 {
     try {
         var formatter = new MaxDepthJsonMediaTypeFormatter()
         {
             Indent = indent
         };
         if (include.Length > 0)
         {
             formatter.SerializerSettings.MaxDepth = 100;                     //include.Max<string>(s => s.Split('.').Length * 5);
             formatter.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects;
         }
         else
         {
             formatter.SerializerSettings.MaxDepth = 1;
         }
         return(Request.CreateResponse <IQueryable <Foto> >(HttpStatusCode.OK, fotoRepository.GetAll(include).AsQueryable(), formatter));
     } catch (Exception _excepcion) {
         log.Error(_excepcion);
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, _excepcion));
     }
 }