public async Task <IActionResult> Create(CreateTrainerModel trainerModel)
        {
            if (!this.ModelState.IsValid)
            {
                var professions = this.professionsService.GetAll <TrainerProfessionsViewModel>();

                trainerModel.Professions = professions;

                return(this.View(trainerModel));
            }

            if (trainerModel.Image.ContentType != "image/jpeg" &&
                trainerModel.Image.ContentType != "image/png" &&
                trainerModel.Image.ContentType != "svg+xml")
            {
                this.ModelState.AddModelError(string.Empty, InvalidImageType);

                return(this.View(trainerModel));
            }

            trainerModel.ImageUrl = await this.cloudinaryService.UploadAsync(trainerModel.Image, trainerModel.Image.FileName);

            var serviceModel = AutoMapperConfig.MapperInstance.Map <CreateTrainerInputModel>(trainerModel);

            await this.trainersService.CreateAsync(serviceModel);

            return(this.RedirectToAction("Index"));
        }
        public IActionResult Create()
        {
            var professions = this.professionsService.GetAll <TrainerProfessionsViewModel>();

            var trainerModel = new CreateTrainerModel
            {
                Professions = professions,
            };

            return(this.View(trainerModel));
        }