Esempio n. 1
0
        public ActionResult Edit(long id)
        {
            long?cityId = AdminHelper.GetCityId(this.HttpContext);

            if (cityId == null)
            {
                return(View("~/Views/Shared/Error.cshtml", (object)"总部人员无法管理房源!"));
            }
            var house   = HouseService.GetById(id);
            var regions = RegionService.GetAll(cityId.Value);
            //var communitities = CommunitityService.
            var roomTypes      = IdNameService.GetByTypeName("户型");
            var status         = IdNameService.GetByTypeName("房屋状态");
            var decorateStatus = IdNameService.GetByTypeName("装修状态");
            var types          = IdNameService.GetByTypeName("房屋类别");
            HouseEditViewModel houseEditView = new HouseEditViewModel();

            houseEditView.House          = house;
            houseEditView.Status         = status;
            houseEditView.DecorateStatus = decorateStatus;
            houseEditView.Regions        = regions;
            houseEditView.RoomTypes      = roomTypes;
            houseEditView.Types          = types;
            return(View(houseEditView));
        }
Esempio n. 2
0
        public ActionResult Edit(long Id)
        {
            long userId = (long)AdminHelper.GetUserId(HttpContext);
            var  user   = AdminUserService.GetById(userId);

            if (user.CityId == null)
            {
                //TODO如果“总部不能***”的操作很多,也可以定义成一个AuthorizeFilter
                //最好用FilterAttribute的方式标注,这样对其他的不涉及这个问题的地方效率高
                //立即实现
                return(View("ERROR", (object)"总部不能进行房源管理"));
            }
            var regions             = RegionService.GetAll((long)user.CityId);
            var roomTypes           = IdNameService.GetAll("户型");
            var status              = IdNameService.GetAll("房屋状态");
            var decorateStatus      = IdNameService.GetAll("装修状态");
            var types               = IdNameService.GetAll("出租类别");
            var attachments         = AttachmentService.GetAll();
            var house               = HouseService.GetById(Id);
            HouseEditGetModel model = new HouseEditGetModel();

            model.Attachments    = attachments;
            model.DecorateStatus = decorateStatus;
            model.Regions        = regions;
            model.RoomTypes      = roomTypes;
            model.Status         = status;
            model.Types          = types;
            model.House          = house;
            return(View(model));
        }
Esempio n. 3
0
        public ActionResult Add()
        {
            long adminUserId = (long)Session["LoginUserId"];
            long?cityId      = AdminUserService.GetById(adminUserId).CityId;

            if (cityId == null)
            {
                return(View("Error", (object)"总部人员不能管理房源"));
            }
            var regions            = RegionService.GetAll(cityId.Value);
            var roomTypes          = IdNameService.GetAll("户型");
            var statuses           = IdNameService.GetAll("房屋状态");
            var decorationStatuses = IdNameService.GetAll("装修状态");
            var types               = IdNameService.GetAll("房屋类别");
            var attachments         = AttachmentService.GetAll();
            HouseAddViewModel model = new HouseAddViewModel()
            {
                Regions         = regions,
                RoomTypes       = roomTypes,
                Statuses        = statuses,
                DecorateStatues = decorationStatuses,
                Types           = types,
                Attachments     = attachments
            };

            return(View(model));
        }
Esempio n. 4
0
        public ActionResult AddHouse()
        {
            long?id     = AdminHelper.AdminUserId(HttpContext);
            long?cityId = AdminUserService.GetById(id.Value).CityId;

            if (cityId == null)
            {
                return(View("ERROR", "总部不能进行房源管理"));
            }
            var regions = RegionService.GetCityAll(cityId.Value).ToList();

            regions.Insert(0, new RegionDTO()
            {
                Id = 0, Name = "请选择"
            });
            var roomTypes           = IdNameService.GetAll("户型");
            var statuses            = IdNameService.GetAll("房屋状态");
            var decorateStatuses    = IdNameService.GetAll("装修状态");
            var attachments         = AttachmentService.GetAll();
            var types               = IdNameService.GetAll("房屋类别");
            HouseAddViewModel model = new HouseAddViewModel();

            model.Regions          = regions;
            model.RoomTypes        = roomTypes;
            model.Statuses         = statuses;
            model.DecorateStatuses = decorateStatuses;
            model.Attachments      = attachments;
            model.Types            = types;
            return(View(model));
        }
Esempio n. 5
0
        public ActionResult Edit(long id)
        {
            long adminUserId = (long)Session["LoginUserId"];
            long?cityId      = AdminUserService.GetById(adminUserId).CityId;

            if (cityId == null)
            {
                return(View("Error", (object)"总部人员不能管理房源"));
            }
            var house              = HouseService.GetById(id);
            var regions            = RegionService.GetAll(cityId.Value);
            var roomTypes          = IdNameService.GetAll("户型");
            var statuses           = IdNameService.GetAll("房屋状态");
            var decorationStatuses = IdNameService.GetAll("装修状态");
            var types              = IdNameService.GetAll("房屋类别");
            var attachments        = AttachmentService.GetAll();
            var model              = new HouseEditViewModel();

            model.Attachments     = attachments;
            model.DecorateStatues = decorationStatuses;
            model.House           = house;
            model.Regions         = regions;
            model.RoomTypes       = roomTypes;
            model.Statuses        = statuses;
            model.Types           = types;
            return(View(model));
        }
Esempio n. 6
0
        public ActionResult GetVideoTypeList(long id)
        {
            var model = IdNameService.GetById(id);

            var videoTypeList = IdNameService.GetByTypeName(model.Name).Select(m => new { text = m.Name, value = m.Id });

            return(Json(new AjaxResult {
                Result = true, Data = videoTypeList
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 7
0
        public ActionResult Index()
        {
            long cityId = FrontHelper.GetCityId(this.HttpContext);
            var  cities = CityService.GetAll();
            var  types  = IdNameService.GetByTypeName("房屋类别");
            HomeIndexViewModel homeIndexView = new HomeIndexViewModel();

            homeIndexView.Cities = cities;
            homeIndexView.Types  = types;
            return(View(homeIndexView));
        }
Esempio n. 8
0
        static void Main3(string[] args)
        {
            IAdminUserService  adminService      = new AdminUserService();
            IRoleService       roleService       = new RoleService();
            IPermissionService permissionService = new PermissionService();
            ITestPaperService  paperService      = new TestPaperService();
            IIdNameService     idNameSevice      = new IdNameService();
            IUserService       userService       = new UserService();
            IActivityService   actService        = new ActivityService();

            //long[] ids = { 1, 2 };
            long[] roleids = { 1 };
            //long[] addIds = { 2 };

            //permissionService.AddNew("manager", "管理员权限");
            //permissionService.AddNew("list", "查看列表权限");

            //long roleId = roleService.AddNew("系统管理员", "拥有所有权限");
            //long roleId1 = roleService.AddNew("普通账户", "拥有查看列表权限");

            //permissionService.AddPermissionIds(roleId, ids);
            //permissionService.AddPermissionIds(roleId1, addIds);

            //long id = adminService.AddAdminUser("fsddf", "15615615656", true, "*****@*****.**", "1");

            //roleService.AddRoleIds(id, roleids);

            //Console.WriteLine(id);

            //idNameSevice.AddNew("正确答案", "A",null);
            //idNameSevice.AddNew("正确答案", "B", null);
            //idNameSevice.AddNew("正确答案", "C", null);
            //idNameSevice.AddNew("正确答案", "D", null);
            //idNameSevice.AddNew("活动状态", "待开始", null);
            //idNameSevice.AddNew("活动状态", "答题进行中", null);
            //idNameSevice.AddNew("活动状态", "待开奖", null);
            //long id= idNameSevice.AddNew("活动状态", "已结束", null);
            //long id = userService.AddNew("xh313", "", "", "154186147455", false, "rqqewqeq");
            //actService.AddUserId(11, 2);
            //Console.WriteLine(actService.AddUserId(11,1));

            //userService.e

            //Console.WriteLine(paperService.Delete(3));
            Console.ReadKey();
        }
Esempio n. 9
0
        public ActionResult Edit(long id = 0)
        {
            var courseTypeList = IdNameService.GetByTypeName("课程类型").Select(m => new { text = m.Name, value = m.Id });

            ViewBag.CourseTypeList = JsonConvert.SerializeObject(courseTypeList);

            var videoTypeList = new List <IdNameDto>().Select(m => new { text = m.Name, value = m.Id });

            ViewBag.VideoTypeList = JsonConvert.SerializeObject(videoTypeList);
            VideoAddDto model;

            if (id <= 0)
            {
                model = new VideoAddDto();
            }
            else
            {
                model = VideoService.GetById(id);
            }
            ViewBag.Model = JsonConvert.SerializeObject(model);
            return(View(model));
        }