Пример #1
0
        public IHttpActionResult UploadPhotoForCourse(string linking)
        {
            try
            {
                var photoLink     = UploadPhoto(SaveFile(), linking);
                var updatedCourse = moderation.FindCourseByLinking(linking);
                updatedCourse.Photo = photoLink;
                moderation.UpdateCourse(updatedCourse);

                return(this.Ok(photoLink));
            }
            catch (ArgumentNullException ex)
            {
                var message = $"Photo not found. {ex.Message}";
                return(this.BadRequest(message));
            }
        }