예제 #1
0
 public ActionResult Add()
 {
     if (!IsUserLogin)
     {
         return Redirect("/m/account/login");
     }
     DemandModel model = new DemandModel();
     model.DemandCategories = demandManager.GetDemandCategories();
     model.Provinces = cityService.GetProvinces(true);
     return View(model);
 }
예제 #2
0
        public ActionResult Index(string id)
        {
            DemandModel model = new DemandModel();
            model.DemandCategories = demandManager.GetDemandCategories();

            string city = string.Empty;
            if (!string.IsNullOrEmpty(CurrentCityId))
            {
                city = CurrentCityId;
            }

            //页码,总数重置
            int page = 1;
            if (!string.IsNullOrEmpty(id))
            {
                Int32.TryParse(id, out page);
            }
            int allCount = 0;
            if (string.IsNullOrEmpty(city))
            {
                model.Demands = demandService.GetDemands(10, page, out allCount);//每页显示10条
            }
            else
            {
                model.Demands = demandService.GetDemandsByCity(10, page, city, out allCount);//每页显示10条
            }
            //分页
            if (model.Demands != null && model.Demands.Count > 0)
            {
                model.PageIndex = page;//当前页数
                model.PageSize = 10;//每页显示多少条
                model.PageStep = 10;//每页显示多少页码
                model.AllCount = allCount;//总条数
                if (model.AllCount % model.PageSize == 0)
                {
                    model.PageCount = model.AllCount / model.PageSize;
                }
                else
                {
                    model.PageCount = model.AllCount / model.PageSize + 1;
                }
            }

            return View(model);
        }
예제 #3
0
        public ActionResult Show(string id)
        {
            DemandModel model = new DemandModel();

            int tempId = 0;
            if (!string.IsNullOrEmpty(id))
            {
                Int32.TryParse(id, out tempId);
            }

            if (tempId != 0)
            {
                var demand = demandService.GetDemandById(tempId);

                if (demand != null)
                {
                    if (!IsVip)
                    {
                        demand.Phone = "VIP会员可见";
                        demand.QQWeixin = "VIP会员可见";
                        demand.Email = "VIP会员可见";
                        demand.Address = "VIP会员可见";
                    }
                }
                model.Demand = demand;
            }

            if (model.Demand == null)
            {
                model.Demand = new Demand();
                model.Demand.Title = "该需求不存在或已被删除";
                model.Demand.StartTime = DateTime.Now;
                model.Demand.EndTime = DateTime.Now;
            }

            model.IsMember = IsUserLogin;
            model.IsVIP = IsVip;

            return View(model);
        }