public IActionResult UserDelete(int?id)
        {
            var entity = _userRegisterService.GetById((int)id);

            if (entity == null)
            {
                return(NotFound());
            }
            _userRegisterService.Delete(entity);

            return(RedirectToAction("UserView"));
        }
Example #2
0
        public async Task <ActionResult> Delete()
        {
            try
            {
                Guid id = Guid.Empty;

                if (HttpContext.User.Identity is ClaimsIdentity identity)
                {
                    id = Guid.Parse(identity.FindFirst(ClaimTypes.Sid).Value);
                }

                await Task.Run(() => _userRegisterService.Delete(id));

                return(NoContent());
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, ex.ToString()));
            }
        }