Ejemplo n.º 1
0
        public IActionResult Create(MemberMD metaData)
        {
            _context.Members.Add(metaData.ToEntity());

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

                return(View(metaData));
            }

            return(RedirectToAction("Index", "Member"));
        }
Ejemplo n.º 2
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"));
        }
Ejemplo n.º 3
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"));
        }