Beispiel #1
0
        /// <summary>
        /// This method must be wrapped under transaction
        /// </summary>
        /// <param name="email"></param>
        /// <param name="busEx"></param>
        /// <returns></returns>
        public async Task <IdentityResult> DeleteUsers(string email, IBusinessException busEx)
        {
            if (userResultType is UnauthorisedUser || userResultType is AnonymousUser)
            {
                busEx.Add("SpecialAppUsers", $"No user found for {email}");
            }

            busEx.ThrowIfErrors();

            var repo = uow.GetRepository <Users>();

            var users = await repo.GetAll().GetActive().FirstOrDefaultAsync(x => x.SpecialAppUsersId == userResultType.Id);

            if (users == null)
            {
                busEx.Add("Users", $"No user found for {email}");
            }

            busEx.ThrowIfErrors();

            await repo.Delete(users);

            return(await usrMngService.DeleteAsync((SpecialAppUsers)userResultType));
        }
 public async Task<ActionResult> DeleteAsync()
 {
     var errors = await _userManager.DeleteAsync();
     if (errors == null) return Ok();
     return new BadRequestObjectResult(errors);
 }