Beispiel #1
0
        public HttpResponseMessage Get(string type)
        {
            try
            {
                List <SelectListItem> list = new List <SelectListItem>();

                switch (type.ToLower())
                {
                case "countries":
                    list = ListService.GetCountries(null, _lookupRepository);
                    break;

                case "gadgets":
                    list = ListService.GetGadgets(_configRepository);
                    break;

                case "roles":
                    list = ListService.GetRoles(_secutiryReposiory);
                    break;

                case "areatypes":
                    list = ListService.GetAreaTypes();
                    break;

                case "galleries":
                    list = ListService.GetGalleries(_galleryRepsitory);
                    break;

                case "articletypes":
                    list = ListService.GetArticleTypes(null, _configRepository);
                    break;

                case "parentcategories":
                    list = ListService.GetParentCategories(null, _lookupRepository);
                    break;

                case "categories":
                    list = ListService.GetCategories(null, _lookupRepository);
                    break;

                case "flags":
                    return(Request.CreateResponse(HttpStatusCode.OK, ListService.GetFlags("")));

                case "phonetypes":
                    list = ListService.GetPhoneTypes(null);
                    break;
                }

                if (list == null)
                {
                    return(Request.CreateResponse(HttpStatusCode.NoContent));
                }

                return(Request.CreateResponse(HttpStatusCode.OK, list));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }