public MemberService(IUnitOfWork unitOfWork) { _unitOfWork = unitOfWork; _MemberRep = new MemeberRepository(unitOfWork); _ZipCodeRep = new ZipCodeRepository(unitOfWork); ReturnModel = new PublicMethodResult(); }
public ActionResult MemberMain(DataAction actions, MemberDetailViewModel memberViewModel) { MemberViewModel searchBlock = (MemberViewModel)TempData["MemeberSelect"]; // KeepSelectBlock MemberKeepSelectBlock(searchBlock, actions); PublicMethodResult ResultViewModel = new PublicMethodResult(); if (ModelState.IsValid) { if (actions == DataAction.Create) //建立資料 { memberViewModel.MemberID = Guid.NewGuid(); // 日後可統一 Guid 或是 String 型態 ResultViewModel = _MemberService.CreateMember(memberViewModel, SignInManagerId); } else //更新資料 { ResultViewModel = _MemberService.UpdateMember(memberViewModel, SignInManagerId); } _MemberService.Save(); } TempData["message"] = ResultViewModel.Result; if (ResultViewModel.ResultBool) // 取決於導向頁面, True = 返回SystemRoles, False = 停在本頁 { return(RedirectToAction("Member", new { ViewModel = searchBlock, pages = searchBlock.page })); } // 顯示資料 //memberViewModel = _MemberService.ReturnMemberDetail(actions, memberViewModel.MemberID.ToString().ToUpper()); return(View(memberViewModel)); }
public PublicService() { _PublicRep = new PublicMethodRepository(); ReturnModel = new PublicMethodResult(); }