コード例 #1
0
        public ActionResult Edit(int ID)
        {
            CityCateViewModel model = new CityCateViewModel();
            var entity = cityService.Find(ID);

            model.CateName = entity.CateName;
            model.ID       = entity.ID;
            model.Code     = entity.Code;

            model.Level      = entity.Level;
            model.OrderIndex = entity.OrderIndex;
            model.PID        = entity.PID;
            ViewBag.Data_PID = GetSelectList(entity.PID.HasValue ? entity.PID.Value : 0);
            return(View(model));
        }
コード例 #2
0
ファイル: ListController.cs プロジェクト: navy235/7980Site
        public ActionResult Index(int province   = 1, int city = 0,
                                  int mediacode  = 0,
                                  int formatcode = 0,
                                  int ownercode  = 0,
                                  int periodcode = 0,
                                  int authstatus = 0,
                                  int deadline   = 0,
                                  int price      = 0,
                                  int order      = 0,
                                  int descending = 0,
                                  int page       = 1,
                                  string query   = null,
                                  string dq      = null)
        {
            if (city == 1)
            {
                city = 0;
            }

            //搜索条件
            QueryTerm queryTerm = new QueryTerm()
            {
                Province   = province,
                City       = city,
                MediaCode  = mediacode,
                FormatCode = formatcode,
                OwnerCode  = ownercode,
                PeriodCode = periodcode,
                Page       = page,
                AuthStatus = authstatus,
                DeadLine   = deadline,
                Price      = price,
                Order      = order,
                Descending = descending,
                Query      = query,
                Dq         = dq
            };

            if (!string.IsNullOrEmpty(queryTerm.Dq))
            {
                if (queryTerm.Dq.Equals(DateTime.Now.ToString("yyyy-MM-dd")))
                {
                    queryTerm.Dq = null;
                }
            }

            CacheService.Clear();

            if (queryTerm.City != 0)
            {
                var cityCate = CityCateService.Find(queryTerm.City);
                queryTerm.CityCateCode = cityCate.Code;
                queryTerm.CityMaxCode  = Utilities.GetMaxCode(cityCate.Code, cityCate.Level);
            }

            if (queryTerm.MediaCode != 0)
            {
                var mediaCate = MediaCateService.Find(queryTerm.MediaCode);
                queryTerm.MediaCateCode = mediaCate.Code;
                queryTerm.MediaMaxCode  = Utilities.GetMaxCode(mediaCate.Code, mediaCate.Level);
            }


            ViewBag.Search = GetSearch(queryTerm);

            ViewBag.PriceListFilter = GetPriceListFilter(queryTerm);

            ViewBag.DeadLineMonthFilter = GetDeadLineMonthFilter(queryTerm);

            ViewBag.DefaultOrderUrl = Url.Action("index", new
            {
                province   = queryTerm.Province,
                city       = queryTerm.City,
                mediacode  = queryTerm.MediaCode,
                formatcode = queryTerm.FormatCode,
                ownercode  = queryTerm.OwnerCode,
                periodcode = queryTerm.PeriodCode,
                authstatus = queryTerm.AuthStatus,
                deadline   = queryTerm.DeadLine,
                price      = queryTerm.Price,
                order      = 0,
                descending = 0,
                page       = 1,
            });

            ViewBag.PriceOrderAscUrl = Url.Action("index", new
            {
                province   = queryTerm.Province,
                city       = queryTerm.City,
                mediacode  = queryTerm.MediaCode,
                formatcode = queryTerm.FormatCode,
                ownercode  = queryTerm.OwnerCode,
                periodcode = queryTerm.PeriodCode,
                authstatus = queryTerm.AuthStatus,
                deadline   = queryTerm.DeadLine,
                price      = queryTerm.Price,
                order      = (int)SortProperty.Price,
                descending = (int)SortDirection.Ascending,
                page       = 1
            });

            ViewBag.PriceOrderDescUrl = Url.Action("index", new
            {
                province   = queryTerm.Province,
                city       = queryTerm.City,
                mediacode  = queryTerm.MediaCode,
                formatcode = queryTerm.FormatCode,
                ownercode  = queryTerm.OwnerCode,
                periodcode = queryTerm.PeriodCode,
                authstatus = queryTerm.AuthStatus,
                deadline   = queryTerm.DeadLine,
                price      = queryTerm.Price,
                order      = (int)SortProperty.Price,
                descending = (int)SortDirection.Descending,
                page       = 1
            });

            ViewBag.NoAuthedUrl = Url.Action("index", new
            {
                province   = queryTerm.Province,
                city       = queryTerm.City,
                mediacode  = queryTerm.MediaCode,
                formatcode = queryTerm.FormatCode,
                ownercode  = queryTerm.OwnerCode,
                periodcode = queryTerm.PeriodCode,
                authstatus = 0,
                deadline   = queryTerm.DeadLine,
                price      = queryTerm.Price,
                order      = queryTerm.Order,
                descending = queryTerm.Descending,
                page       = 1
            });

            ViewBag.AuthedUrl = Url.Action("index", new
            {
                province   = queryTerm.Province,
                city       = queryTerm.City,
                mediacode  = queryTerm.MediaCode,
                formatcode = queryTerm.FormatCode,
                ownercode  = queryTerm.OwnerCode,
                periodcode = queryTerm.PeriodCode,
                authstatus = 1,
                deadline   = queryTerm.DeadLine,
                price      = queryTerm.Price,
                order      = queryTerm.Order,
                descending = queryTerm.Descending,
                page       = 1
            });

            ViewBag.Authed = queryTerm.AuthStatus == 1;


            ViewBag.Result = GetResult(queryTerm);

            ViewBag.Sort = GetSort(queryTerm);

            ViewBag.Query = queryTerm;

            return(View());
        }