public void TestIdName() { string typeName = Guid.NewGuid().ToString(); string name1 = Guid.NewGuid().ToString(); string name2 = Guid.NewGuid().ToString(); long id1 = inSvc.AddNew(typeName, name1); long id2 = inSvc.AddNew(typeName, name2); Assert.AreEqual(inSvc.GetById(id1).Name, name1); Assert.AreEqual(inSvc.GetAll(typeName).Length, 2); Assert.AreEqual(inSvc.GetAll(typeName)[1].Name, name2); }
public void TestMethod1() { string typeName = Guid.NewGuid().ToString(); string name1 = Guid.NewGuid().ToString(); string name2 = Guid.NewGuid().ToString(); id1 = idNameService.AddNew(typeName, name1); id2 = idNameService.AddNew(typeName, name2); Assert.AreEqual(idNameService.GetById(id1).Name, name1); Assert.AreEqual(idNameService.GetAll(typeName).Length, 2); Assert.AreEqual(idNameService.GetAll(typeName)[1].Name, name2); }
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)); }
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)); }
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)); }
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)); }