Esempio n. 1
0
        public Practice CreateModel(PracticeModel model, Practice datamodel = null)
        {
            var result = datamodel ?? new Practice();

            result.Timestamp           = model.Timestamp;
            result.Repetitions         = model.Repetitions;
            result.ExerciseId          = model.ExerciseId;
            result.ScheduleId          = model.ScheduleId;
            result.UserId              = model.UserId;
            result.Weight              = model.Weight;
            result.NumberOfRepetitions = model.NumberOfRepetitions;
            result.Id = model.Id;
            return(result);
        }
Esempio n. 2
0
        public async Task<IHttpActionResult> CreatePractice(PracticeModel practice)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var datamodel = this.TheModelFactory.CreateModel(practice);
            await this.AppRepository.Practices.AddAsync(datamodel);
            
            practice = this.TheModelFactory.CreateViewModel(datamodel);
            return CreatedAtRoute("GetPracticeById", new { id = practice.Id }, practice);
        }
Esempio n. 3
0
 public Practice CreateModel(PracticeModel model, Practice datamodel = null)
 {
     var result = datamodel ?? new Practice();
     result.Timestamp = model.Timestamp;
     result.Repetitions = model.Repetitions;
     result.ExerciseId = model.ExerciseId;
     result.ScheduleId = model.ScheduleId;
     result.UserId = model.UserId;
     result.Weight = model.Weight;
     result.NumberOfRepetitions = model.NumberOfRepetitions;
     result.Id = model.Id;
     return result;
 }