public IBusinessException When(Func <T, bool> func) { if (func(Value)) { busEx.Add("", ""); } return(busEx); }
/// <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 <IResolvedUser> GetUser(string email) { if (string.IsNullOrEmpty(email)) { busEx.Add("SpecialAppUsers", "Email is required to find the user"); } busEx.ThrowIfErrors(); var result = await Service.GetUser(email); userResultType = result; return(GetResolveUser()); }