コード例 #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));
            }
        }
コード例 #2
0
ファイル: ListController.cs プロジェクト: BaqerNaqvi/DVS-dmn
        public ResponseModel_GetCatogries GetCatogries(GetCategoriesRequestModel model)
        {
            var response = new ResponseModel_GetCatogries
            {
                Success  = false,
                Messages = new List <string>()
            };

            if (model == null)
            {
                response.Messages.Add("model is not mapped");
                response.Data = model;
            }
            else
            {
                try
                {
                    var menuItems = ListService.GetCategories(model.Status);
                    response.Data            = menuItems;
                    response.MessageContents = "Enjoy free delivery for the whole week from 10am-7pm";
                    response.ShowMessage     = true;
                    response.MessageTitle    = "Free Delivery";

                    response.Messages.Add("Success");
                    response.Success = true;
                }
                catch (Exception excep)
                {
                    response.Messages.Add("Something bad happened.");
                }
            }
            return(response);
        }
コード例 #3
0
        public ActionResult PartnerCreate()
        {
            var cats = ListService.GetCategories(true);

            return(View(new ListItemLocal {
                Categoreis = cats
            }));
        }
コード例 #4
0
        public ActionResult Edit(ListItemLocal itemDetail)
        {
            var relativePath = ConfigurationManager.AppSettings["saveImagesIn"];

            if (itemDetail.Logo != null)
            {
                Functions.SaveFile(itemDetail.Logo, relativePath, Server.MapPath(relativePath), itemDetail.Id + "_Logo");
            }
            if (itemDetail.Background != null)
            {
                Functions.SaveFile(itemDetail.Background, relativePath, Server.MapPath(relativePath), itemDetail.Id + "_Background");
            }
            itemDetail.Id = ListService.Edit(itemDetail);
            var cats = ListService.GetCategories(true);

            ViewBag.Type = new SelectList(cats, "CatId", "Name", itemDetail.Id);
            return(RedirectToAction("view"));
        }
コード例 #5
0
        // GET: MenuItems/Edit/5
        public async Task <ActionResult> Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ListItem item = await db.ListItems.FindAsync(id);

            ListItemLocal itemDetail = item.MapListItem();

            if (itemDetail == null)
            {
                return(HttpNotFound());
            }
            var cats = ListService.GetCategories(true);

            ViewBag.Type = new SelectList(cats, "CatId", "Name", itemDetail.Type);
            return(View(itemDetail));
        }