예제 #1
0
        public async Task <ResponseModel> Create(ExerciseModel model)
        {
            var response = new ResponseModel();

            if (model == null)
            {
                throw new NullParameterException();
            }

            await _context.ExerciseRepository.AddAsync(new Exercise()
            {
                Id                 = Guid.NewGuid(),
                MainMuscleId       = new Guid(model.MainMuscleId),
                SecondaryMuscleIds = model.SecondaryMuscleIds,
                Name               = model.Name,
                Description        = model.Description,
                Notes              = model.Notes,
                HardLevel          = model.HardLevel,
                Precedence         = model.Precedence,
                IsActive           = model.IsActive,
                CreatedBy          = model.CreatedBy,
                CreatedDate        = DateTime.Now
            });

            await _context.SaveChangesAsync().ConfigureAwait(false);

            return(response);
        }
예제 #2
0
        public async Task <ResponseModel> Create(ExerciseResourceModel model)
        {
            var response = new ResponseModel();

            if (model == null)
            {
                throw new NullParameterException();
            }

            await _context.ExerciseResourceRepository.AddAsync(new ExerciseResource()
            {
                Id          = Guid.NewGuid(),
                ExerciseId  = new Guid(model.ExerciseId),
                Video       = model.Video,
                Image       = model.Image,
                Description = model.Description,
                Notes       = model.Notes,
                IsVideo     = model.IsVideo,
                Precedence  = model.Precedence,
                IsActive    = model.IsActive,
                CreatedBy   = model.CreatedBy,
                CreatedDate = DateTime.Now
            });

            await _context.SaveChangesAsync().ConfigureAwait(false);

            return(response);
        }
예제 #3
0
        public async Task <ResponseModel> Create(ExerciseLevelModel model)
        {
            var response = new ResponseModel();

            if (model == null)
            {
                throw new NullParameterException();
            }

            await _context.ExerciseLevelRepository.AddAsync(new ExerciseLevel()
            {
                Id          = Guid.NewGuid(),
                Name        = model.Name,
                Precedence  = model.Precedence,
                IsActive    = model.IsActive,
                CreatedBy   = model.CreatedBy,
                CreatedDate = DateTime.Now
            });

            await _context.SaveChangesAsync().ConfigureAwait(false);

            return(response);
        }