示例#1
0
        public async Task <IEnumerable <GymContext> > GetAllAsync()
        {
            var gyms = await UserEntityService.GetAllAsync();

            var gymsContext = GymConverter.ConvertToGymContextList(gyms);

            return(gymsContext);
        }
示例#2
0
        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);
        }