// 刪除會員 public ActionResult Delete(long RecordID) { RepositoryMember repo = new RepositoryMember(); MemberMD data = repo.GetMemberMD(RecordID); return(data == null?PartialView("_Error") : PartialView("_Delete", data)); }
public ActionResult Delete(MemberMD Data) { RepositoryMember repo = new RepositoryMember(); OperationResult <MemberViewModel> result = repo.Delete(Data); return(Json(result)); }
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)); }
public IActionResult Create() { var data = new MemberMD(); ModelState.Clear(); return(View(data)); }
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)); }
public IActionResult Create(MemberMD metaData) { _context.Members.Add(metaData.ToEntity()); if (_context.SaveChanges() <= 0) { ViewBag.ErrorMessage = $"新增失敗,請聯絡系統管理員"; return(View(metaData)); } return(RedirectToAction("Index", "Member")); }
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")); }
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")); }
// 新增會員 public ActionResult Create() { MemberMD data = new MemberMD(); return(PartialView("_Create", data)); }