Ejemplo n.º 1
0
        public IBusinessException When(Func <T, bool> func)
        {
            if (func(Value))
            {
                busEx.Add("", "");
            }

            return(busEx);
        }
Ejemplo n.º 2
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));
        }
Ejemplo n.º 3
0
        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());
        }