/// <summary> /// 修改活动 /// </summary> /// <param name="id">活动ID</param> /// <returns></returns> public ActionResult EditActivity(int id) { ViewClass model = new ViewClass(); ClassServiceClient client = new ClassServiceClient(); model = client.Get(id); ViewBag.Title = "编辑活动"; ViewBag.Id = id; YogaDicItemServiceClient dicClient = new YogaDicItemServiceClient(); ViewData["YogaTopic"] = (from topic in (dicClient.Dics(d => d.DicId == CommonInfo.Topic)) select new SelectListItem() { Text = topic.ItemName, Value = topic.ID.ToString(), Selected = model.TopicIds.Split(',').Contains(topic.ID.ToString()) }).ToList(); //逐层获取地理位置区域 List <DistrictModel> DistrictModelList = client.GetDistrictModel(model.AreaID); ViewBag.DistrictModelList = Newtonsoft.Json.JsonConvert.SerializeObject(DistrictModelList); //获取活动关联的老师并拼成HTML展示在页面 ClassTeacherServiceClient subClient = new ClassTeacherServiceClient(); List <ViewClassTeacher> ClassTeacherModel = subClient.GetClass_Id(id); string html = ""; if (ClassTeacherModel != null) { foreach (var item in ClassTeacherModel) { html += "<li class=teacher id=teacher_" + item.Id + "" + " teacherid=" + item.TeacherId + "><div class=teacher-info><div class=name><img src=" + item.Avatar + "> " + item.Name + "<span>" + item.Gender + "</span> <span>" + item.Country + "</span> <span>" + item.YogaSystem + "</span></div></div><div class=teacher-close> </div></li>"; } } ViewData["html"] = new MvcHtmlString(html); string centerHtml = ""; CentersServiceClient centerClient = new CentersServiceClient(); if (!string.IsNullOrWhiteSpace(model.CenterID)) { var centerList = centerClient.GetCentersListByClassCenterID(model.CenterID); foreach (var dataItem in centerList) { centerHtml += "<li class=Center id=CenterID_" + dataItem.CenterId + " CenterID=" + dataItem.CenterId + "><div class=Center-info><div class=name><img src=" + dataItem.CenterPortraint + "/> " + dataItem.CenterName + " </div></div><div class=Center-close> </div></li>"; } } ViewData["centerHtml"] = new MvcHtmlString(centerHtml); return(View(model)); }
public ActionResult Index() { YogaDicItemServiceClient dicClient = new YogaDicItemServiceClient(); List <ViewYogaDicItem> dics = dicClient.GetSelectList(CommonInfo.Topic, true); ViewData["YogaTopic"] = (from topic in (dicClient.Dics(d => d.DicId == CommonInfo.Topic)) select new SelectListItem() { Text = topic.ItemName, Value = topic.ID.ToString() }).ToList(); return(View()); }
public ActionResult AddActivity() { if (user.Uid == 0 || user.Uid.IsNullOrEmpty()) { return(Content("<script>if (confirm('你还没有登录,是否登录?')) { window.location='/Login/Login'; }</script>")); } else { YogaDicItemServiceClient dicClient = new YogaDicItemServiceClient(); ViewData["YogaTopic"] = (from topic in (dicClient.Dics(d => d.DicId == CommonInfo.Topic)) select new SelectListItem() { Text = topic.ItemName, Value = topic.ID.ToString() }).ToList(); return(View()); } }
public ActionResult AddActivity(int?id) { if (id == null) { ViewBag.Title = "添加活动"; } else { ViewBag.Title = "编辑活动"; } ViewBag.Id = id; YogaDicItemServiceClient dicClient = new YogaDicItemServiceClient(); ViewData["YogaTopic"] = (from topic in (dicClient.Dics(d => d.DicId == CommonInfo.Topic)) select new SelectListItem() { Text = topic.ItemName, Value = topic.ID.ToString() }).ToList(); ViewBag.HtmlClassTeacher = TempData["HtmlClassTeacher"] == null ? "''" : TempData["HtmlClassTeacher"]; return(View()); }