예제 #1
0
        public IActionResult Delete(int id)
        {
            var todelete = _repository.Get(id);

            if (todelete != null)
            {
                _repository.Delete(todelete);
                return(Helper.CheckResult(todelete, true));
            }
            return(NotFound());
        }
예제 #2
0
        public async Task <CommonResponce> DeleteAppUser(long Id)
        {
            CommonResponce result = new CommonResponce {
                Stat = false, StatusMsg = "Error on deleting user"
            };

            result.Stat = await _DBUserRepository.Delete(Id).ConfigureAwait(false);

            if (result.Stat)
            {
                result.StatusMsg = "Successfully deleted the user.";
            }
            return(result);
        }
예제 #3
0
        public async Task <IActionResult> Remove(int id)
        {
            AppUser user = await _appUserRepository.GetById(id);

            if (user != null)
            {
                await _appUserRepository.Delete(user);

                TempData["Success"] = "The category deleted..!";
                return(RedirectToAction("List"));
            }
            else
            {
                TempData["Error"] = "The category hasn't been deleted..!";
                return(RedirectToAction("List"));
            }
        }
예제 #4
0
        public async Task <IActionResult> DeleteUser(int id)
        {
            if (!_auth.IsSuperAdmin(User))
            {
                return(NoContent());
            }

            var user = await _repo.GetAppUser(id);

            if (user == null)
            {
                return(BadRequest($"UserId {id} could not be found"));
            }

            _repo.Delete(user);

            if (await _repo.SaveAll())
            {
                return(Ok());
            }

            return(BadRequest("Failed to delete user"));
        }
예제 #5
0
 public void Delete(AppUser appUser)
 {
     _appUserRepository.Delete(appUser);
 }
예제 #6
0
        public void Delete(string Id)
        {
            var user = userRepository.Get(x => x.Id == Id);

            userRepository.Delete(user);
        }