Example #1
0
        public async Task <TrainerContext> SaveOneAsync(TrainerContext trainerContext)
        {
            if (string.IsNullOrEmpty(trainerContext.Id))
            {
                var trainer = TrainerConverter.ConvertToNewTrainer(trainerContext);
                trainer = await UserEntityService.SaveOneAsync(trainer);

                trainerContext.Id = trainer.Id.ToString();
                return(trainerContext);
            }

            var update = TrainerConverter.ConvertToTrainer(trainerContext);
            await UserEntityService.Update(update);

            return(trainerContext);
        }
        public async Task <UserContext> SaveUser(UserContext userContext)
        {
            //User user = UserConverter.ToUser(userContext);
            if (string.IsNullOrEmpty(userContext.Id))
            {
                User user = UserConverter.ConvertToUser(userContext, true);
                await UserEntityService.SaveOneAsync(user);

                userContext.Id = user.Id.ToString();
                return(userContext);
            }
            var update = UserConverter.ConvertToUser(userContext);
            await UserEntityService.Update(update);

            return(userContext);
        }
        public async Task <GymContext> SaveOneAsync(GymContext gymContext)
        {
            if (string.IsNullOrEmpty(gymContext.Id))
            {
                var gym = GymConverter.ConvertToNewGym(gymContext);
                gym = await UserEntityService.SaveOneAsync(gym);

                gymContext.Id = gym.Id.ToString();
                return(gymContext);
            }

            var update = GymConverter.ConvertToGym(gymContext);
            await UserEntityService.Update(update);

            return(gymContext);
        }
Example #4
0
        public async Task <GymContext> SaveGym(GymContext userGymContext)
        {
            if (string.IsNullOrEmpty(userGymContext.Id))
            {
                Gym gymUser = new Gym();
                gymUser = userGymContext.ConvertToNewGym();

                var result = await userEntityService.SaveOneAsync(gymUser);

                return(((Gym)result).ConvertToGymContext());
            }
            //var update = UserConverter.ConvertToUser(userGymContext);
            var update = userGymContext.ConvertToGym();
            await userEntityService.Update(update);

            return(userGymContext);
        }
        public async Task <bool> UpdateAccountAsync(string Id, string email, bool phoneVisibility,
                                                    string userName, bool userVisibility)
        {
            var user = await UserEntityService.GetById(Id);

            user.Email           = email;
            user.PhoneVisibility = phoneVisibility;
            user.UserName        = userName;
            user.UserVisibility  = userVisibility;

            var result = await UserEntityService.Update(user);

            if (null != result)
            {
                return(true);
            }
            return(false);
        }