public async Task <IEnumerable <TrainerContext> > GetAllAsync() { var trainers = await UserEntityService.GetAllAsync(); var trainersContext = TrainerConverter.ConvertToTrainerContextList(trainers); return(trainersContext); }
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); }