Blog.Admin.Web.Controllers.UsersController.Delete C# (CSharp) Method

Delete() public method

public Delete ( string id ) : Task
id string
return Task
        public async Task<ActionResult> Delete(string id)
        {
            try
            {

                if (string.IsNullOrEmpty(id)) throw new Exception("Empty parameter on Users/Delete");

                var user = await UserManager.FindByIdAsync(id);
                if (user != null) return View(user);

                throw new Exception("Failed to get user on Users/Delete");
            }
            catch (Exception ex)
            {
                _errorSignaler.SignalFromCurrentContext(ex);
                TempData.Add("ErrorMessage", ex.Message);
                return RedirectToAction("Index");
            }
        }