Exemplo n.º 1
0
        public ActionResult DeleteAdmin(AdminsDeleteAdminVM model)
        {
            if (ModelState.IsValid)
            {
                Administrator admin = unitOfWork.AdminRepository.GetById(model.Id);
                admin.IsActive = false;
                unitOfWork.Save();

                return RedirectToAction("ManageAdmins");
            }

            return View(model);
        }
Exemplo n.º 2
0
        public ActionResult DeleteAdmin(int? id)
        {
            if (!id.HasValue)
            {
                return RedirectToAction("ManageAdmin");
            }

            Administrator admin = unitOfWork.AdminRepository.GetById(id.Value);

            if (admin == null)
            {
                return RedirectToAction("ManageAdmin");
            }

            AdminsDeleteAdminVM model = new AdminsDeleteAdminVM();
            model.Id = admin.Id;
            model.Username = admin.Username;
            model.FirstName = admin.FirstName;
            model.LastName = admin.LastName;
            model.Email = admin.Email;

            return View(model);
        }