//设计师后台修改 public int UpdateWebCasefromCenter(WebCase webCase) { using (AIYunNetContext context = new AIYunNetContext()) { WebCase originalCase = context.WebCase.Find(webCase.CaseID); if (originalCase != null) { originalCase.CaseBrief = webCase.CaseBrief; originalCase.CaseImageBig = webCase.CaseImageBig; originalCase.thumbnailImage = webCase.thumbnailImage; originalCase.CaseInfo = webCase.CaseInfo; originalCase.CaseTitle = webCase.CaseTitle; originalCase.CompanyID = 0; originalCase.IsTop = webCase.IsTop; originalCase.PeopleID = webCase.PeopleID; originalCase.ShowOrder = 0; originalCase.CostArea = webCase.CostArea; originalCase.Style = webCase.Style; originalCase.HouseType = webCase.HouseType; originalCase.HouseArea = webCase.HouseArea; originalCase.GzStyle = webCase.GzStyle; originalCase.Jobschedule = webCase.Jobschedule; originalCase.EditOn = DateTime.Now; originalCase.DecType = webCase.DecType; context.SaveChanges(); return(1); } else { return(0); } } }
// GET: MobileApp/mAticle public ActionResult AticleIndex(int id) { WebCase webcase = caseSer.GetWebCaseByID(id); List<WebCase> caselist = caseSer.GetHotWebCaseList(3, webcase.DecType); ViewBag.caselist = caselist; return View(webcase); }
//添加案例同时添加缩略图 public int AddWebCase(WebCase webCase) { WebCompanyService comSer = new WebCompanyService(); WebPeopleService peoSer = new WebPeopleService(); using (AIYunNetContext context = new AIYunNetContext()) { context.WebCase.Add(webCase); string[] list = ImageHelper.GetHvtImgUrls(webCase.CaseInfo); foreach (var item in list) { string thum = ImageHelper.GetthumImgByUrl(item); WebCaseImg img = new WebCaseImg { CompanyID = webCase.CompanyID, CompanyName = webCase.CompanyID == 0?"":comSer.GetWebCompanyByID(webCase.CompanyID).CompanyName, PeopleID = webCase.PeopleID, PeopleName = webCase.PeopleID == 0?"":peoSer.GetWebPeopleByID(webCase.PeopleID).PeopleName, imgName = webCase.CaseTitle, Img = item, thumbnailImage = thum, WebCaseID = webCase.CaseID, DecType = webCase.DecType, GzStyle = webCase.GzStyle, JzStyle = webCase.Style }; context.WebCaseImg.Add(img); } context.SaveChanges(); return(1); } }
public ActionResult AddandUpdateCenterCase(int CaseID) { WebCase webcase = webcaseservice.GetWebCaseByID(CaseID); if (webcase == null) { webcase = new WebCase(); } return(View(webcase)); }
public ActionResult AddAndUpdateCase(int CaseID) { WebCase webcase = new WebCase(); if (CaseID != 0) { webcase = webcaseser.GetWebCaseByID(CaseID); } return(View(webcase)); }
/// <summary> /// 点击量增加 /// </summary> /// <returns></returns> public void PageViewAdd(int CaseID) { using (AIYunNetContext context = new AIYunNetContext()) { WebCase originalCase = context.WebCase.Find(CaseID); if (originalCase != null) { originalCase.PageViewCount = originalCase.PageViewCount + 1; context.SaveChanges(); } } }
public int AddandUpdateCenterCase(WebCase webcase) { if (webcase.CaseID != 0) { webcaseservice.UpdateWebCasefromCenter(webcase); } else { webcaseservice.AddWebCase(webcase); } return(1); //WebCase webcase = webcaseservice.GetWebCaseByID(CaseID); }
public JsonResult AddOrEditWebCase(WebCase webCase) { int result = 0; if (webCase != null && webCase.CaseID > 0) { result = webCaseService.UpdateWebCase(webCase); } else { result = webCaseService.AddWebCase(webCase); } return(Json(new { RetCode = result })); }
public ActionResult AddAndUpdateCase(WebCase webCase) { int result = 0; if (webCase != null && webCase.CaseID > 0) { result = webcaseser.UpdateWebCaseByCompany(webCase); } else { result = webcaseser.AddWebCase(webCase); } return(Json(new { RetCode = result }, JsonRequestBehavior.AllowGet)); }
public ActionResult DecCaseDetail(int CaseID) { webCaseService.PageViewAdd(CaseID); WebCase casse = webCaseService.GetWebCaseByID(CaseID); List <WebCase> caselist = webCaseService.GetWebCaseListByPeopleIDAndCount(casse.PeopleID, 2); ViewBag.caselist = caselist; if (casse.CompanyID != 0) { WebCompany com = webCompanyService.GetWebCompanyByID(casse.CompanyID); ViewBag.com = com; } else { WebPeople peo = webPeopleService.GetWebPeopleByID(casse.PeopleID); ViewBag.peo = peo; } List <PeopleComments> commentList = commentService.GetCommentListByID(CaseID, "WebCase", 100); ViewBag.commentList = commentList; return(View(casse)); }
public int DeleteWebCase(int caseID) { WebCompanyService webCompanyService = new WebCompanyService(); WebPeopleService webPeopleService = new WebPeopleService(); using (AIYunNetContext context = new AIYunNetContext()) { WebCase originalCase = context.WebCase.Find(caseID); if (originalCase != null) { originalCase.FlagDelete = 1; originalCase.DeleteOn = DateTime.Now; webCompanyService.updateCaseCountbyCompanyID(originalCase.CompanyID); webPeopleService.updateCaseCountbyPeopleID(originalCase.PeopleID); context.SaveChanges(); return(1); } else { return(0); } } }
public ActionResult AddOrEditWebCase(int caseID) { int CompanyID = Convert.ToInt32(Request["CompanyID"] == null || Request["CompanyID"] == "" ? "0" : Request["CompanyID"]); int PeopleID = Convert.ToInt32(Request["peopleID"] == null || Request["peopleID"] == "" ? "0" : Request["peopleID"]); WebCase webCase = webCaseService.GetWebCaseByID(caseID); if (webCase == null) { webCase = new WebCase(); } IEnumerable <SelectListItem> companys = null; List <WebPeople> peopleList = null; if (SiteHelper.IsSuperVisor() && CompanyID == 0) { //总直接添加或修改 List <WebCompany> companyList = webCompanyService.GetWebCompanyList(); companyList.Add(new WebCompany { CompanyID = 0, CompanyName = "无装修公司" }); companys = companyList.Select(com => new SelectListItem { Value = com.CompanyID.ToString(), Text = com.CompanyName }); peopleList = webPeopleService.GetWebPeopleList(""); peopleList.Add(new WebPeople { PeopleID = 0, PeopleName = "无装修人员" }); peopleList = peopleList.OrderBy(c => c.PeopleID).ToList(); } else if (CompanyID > 0) { //由公司添加或修改 companys = new List <SelectListItem> { new SelectListItem { Value = CompanyID.ToString(), Text = webCompanyService.GetWebCompanyByID(CompanyID).CompanyName } }; peopleList = webPeopleService.GetAllWebPeopleListByCompanyAndPeopleCategory("", CompanyID); } else { //后台商户登录 companys = new List <SelectListItem> { new SelectListItem { Value = SessionHelper.GetSession("companyID").ToString(), Text = SessionHelper.GetSession("companyName").ToString() } }; peopleList = webPeopleService.GetAllWebPeopleListByCompanyAndPeopleCategory("", (int)SessionHelper.GetSession("companyID")); } IEnumerable <SelectListItem> peoples = peopleList.Select(peo => new SelectListItem { Value = peo.PeopleID.ToString(), Text = peo.PeopleName }); if (PeopleID != 0) { companys = new List <SelectListItem> { new SelectListItem { Value = webPeopleService.GetWebPeopleByID(PeopleID).CompanyID.ToString(), Text = webPeopleService.GetWebPeopleByID(PeopleID).CompanyName } }; peoples = new List <SelectListItem> { new SelectListItem { Value = PeopleID.ToString(), Text = webPeopleService.GetWebPeopleByID(PeopleID).PeopleName } }; } ViewBag.Companys = companys.ToList(); ViewBag.Peoples = peoples.ToList(); IEnumerable <SelectListItem> CostAreaList = null; List <WebLookup> commonCostArea = commonService.GetLookupList("Case_cost_area"); CostAreaList = commonCostArea.Select(com => new SelectListItem { Value = com.Code.ToString(), Text = com.Description }); List <WebLookup> commonStyle = commonService.GetLookupList("Case_style"); IEnumerable <SelectListItem> StyleList = commonStyle.Select(com => new SelectListItem { Value = com.Code.ToString(), Text = com.Description }); List <WebLookup> commonHouseType = commonService.GetLookupList("Case_house_type"); IEnumerable <SelectListItem> HouseTypeList = commonHouseType.Select(com => new SelectListItem { Value = com.Code.ToString(), Text = com.Description }); List <WebLookup> commonHouseArea = commonService.GetLookupList("Case_house_area"); IEnumerable <SelectListItem> HouseAreaList = commonHouseArea.Select(com => new SelectListItem { Value = com.Code.ToString(), Text = com.Description }); List <WebLookup> commonDectype = commonService.GetLookupList("Case_DecType"); IEnumerable <SelectListItem> DectypeaList = commonDectype.Select(com => new SelectListItem { Value = com.Code.ToString(), Text = com.Description }); List <WebLookup> commonGzStyle = commonService.GetLookupList("Case_gz_style"); IEnumerable <SelectListItem> GzStyleList = commonGzStyle.Select(com => new SelectListItem { Value = com.Code.ToString(), Text = com.Description }); ViewBag.GzStyleList = GzStyleList; ViewBag.DectypeaList = DectypeaList; ViewBag.CostAreaList = CostAreaList; ViewBag.StyleList = StyleList; ViewBag.HouseTypeList = HouseTypeList; ViewBag.HouseAreaList = HouseAreaList; return(View(webCase)); }
public ActionResult CaseDetail(int CaseID) { WebCase webcase = webCaseService.GetWebCaseByID(CaseID); return(View(webcase)); }