예제 #1
0
        // 刪除會員
        public ActionResult Delete(long RecordID)
        {
            RepositoryMember repo = new RepositoryMember();
            MemberMD         data = repo.GetMemberMD(RecordID);

            return(data == null?PartialView("_Error") : PartialView("_Delete", data));
        }
예제 #2
0
        public ActionResult Delete(MemberMD Data)
        {
            RepositoryMember repo = new RepositoryMember();
            OperationResult <MemberViewModel> result = repo.Delete(Data);

            return(Json(result));
        }
예제 #3
0
        public ActionResult Update(MemberMD Data)
        {
            RepositoryMember repo = new RepositoryMember();
            AuthModel        auth = RepositoryAuthModel.GetAuthModel(HttpContext.User.Identity as FormsIdentity);
            OperationResult <MemberViewModel> result = repo.Update(Data, auth);

            return(Json(result));
        }
예제 #4
0
        public IActionResult Create()
        {
            var data = new MemberMD();

            ModelState.Clear();

            return(View(data));
        }
예제 #5
0
        public IActionResult Delete(int id)
        {
            var entity = _context.Members.Single(x => x.Id == id);

            if (entity == null)
            {
                return(RedirectToAction("Error", "Home", new { message = $"無會員資料" }));
            }

            var metaData = MemberMD.ToMetaData(entity);

            return(View(metaData));
        }
예제 #6
0
        public IActionResult Create(MemberMD metaData)
        {
            _context.Members.Add(metaData.ToEntity());

            if (_context.SaveChanges() <= 0)
            {
                ViewBag.ErrorMessage = $"新增失敗,請聯絡系統管理員";

                return(View(metaData));
            }

            return(RedirectToAction("Index", "Member"));
        }
예제 #7
0
        public IActionResult Update(MemberMD metaData)
        {
            var entity = metaData.ToEntity();

            _context.Entry(entity).State = EntityState.Modified;

            if (_context.SaveChanges() <= 0)
            {
                ViewBag.ErrorMessage = $"更新失敗,請聯絡系統管理員";

                return(View(metaData));
            }

            return(RedirectToAction("Index", "Member"));
        }
예제 #8
0
        public IActionResult Delete(MemberMD metaData)
        {
            var entity = metaData.ToEntity();

            entity.Status = AccountStatusTypeEnum.Delete;

            _context.Entry(entity).State = EntityState.Modified;

            if (_context.SaveChanges() <= 0)
            {
                ViewBag.ErrorMessage = $"刪除失敗,請聯絡系統管理員";

                return(View(metaData));
            }

            return(RedirectToAction("Index", "Member"));
        }
예제 #9
0
        // 新增會員
        public ActionResult Create()
        {
            MemberMD data = new MemberMD();

            return(PartialView("_Create", data));
        }