Beispiel #1
0
        public IHttpActionResult Delete(string userName)
        {
            if (string.IsNullOrWhiteSpace(userName))
            {
                return(BadRequest("User name missing"));
            }

            CcmUser user = _userManager.FindByUserName(userName);

            if (user == null)
            {
                return(NotFound());
            }

            try
            {
                if (!_userManager.Delete(user))
                {
                    return(InternalServerError(new ApplicationException("User not deleted")));
                }

                return(Ok("User deleted"));
            }
            catch (Exception ex)
            {
                log.Error("Could not delete user", ex);
                return(InternalServerError(new ApplicationException("User could not be deleted. " + ex.Message)));
            }
        }
Beispiel #2
0
        public Task DeleteAsync(CcmUser user)
        {
            if (user != null)
            {
                userManager.Delete(user);
            }

            return(null);
        }
        public ActionResult Delete(DeleteUserViewModel model)
        {
            CcmUser user = _userManager.GetUser(model.Id);

            if (user != null)
            {
                _userManager.Delete(user);
            }

            return(RedirectToAction("Index"));
        }