public ActionResult EditDraftProject(int Id) { int result = _MemberService.ReturnLoginnerId(); //MyDraftProjectViewModel dpVM = new MyDraftProjectViewModel(); MyDraftProjectViewModel draftProject = _pdService.GetDraftProjectDetail(Id); if (result == 0) { return(RedirectToAction("Login", "Member")); } ViewBag.MemberId = result; ViewBag.DraftProjectId = draftProject.DraftProjectId; return(View(draftProject)); }
public ActionResult DraftProjectDetailPagePreview(int id) { //var member = (int)System.Web.HttpContext.Current.Session["MyValue"]; var draftprojectDetailService = new ProjectDetailEntityService(); if (id.ToString() != null) { ProjectTotalViewModel draftprojectTotalVM = new ProjectTotalViewModel() { //ProjectDetailItem = new ProjectDetailViewModel(), DraftProjectDetailItem = new MyDraftProjectViewModel(), CreatorInfo = new MemberViewModel(), SelectPlanCards = new SelectPlanListViewModel() { //PlanCardItems = new List<SelectPlanViewModel>(), DraftPlanCardItems = new List <SelectDraftPlanViewModel>() } }; var draftprojectDetail = draftprojectDetailService.GetDraftProjectDetail(id); draftprojectTotalVM.DraftProjectDetailItem = draftprojectDetail; //要本人才能訪問預覽 MemberViewModel vm = Session["member"] == null ? null : (MemberViewModel)Session["Member"]; if (vm == null) { return(HttpNotFound()); } else if (vm != null) { if (draftprojectDetail.MemberId != vm.MemberId) { return(HttpNotFound()); } } var creatorInfo = draftprojectDetailService.GetCreatorInfo(p => p.MemberId == draftprojectTotalVM.DraftProjectDetailItem.MemberId); draftprojectTotalVM.CreatorInfo = creatorInfo; var draftplancards = draftprojectDetailService.GetDraftPlanCards(x => x.DraftProjectId == id); foreach (var item in draftplancards) { draftprojectTotalVM.SelectPlanCards.DraftPlanCardItems.Add(item); } return(View(draftprojectTotalVM)); } else { return(HttpNotFound()); } }