// POST: api/Photos/?phoneId=* public async Task <HttpResponseMessage> AddPhonePhoto(int phoneId, [FromBody] AvatarViewModel photo) { string fileName = Path.GetRandomFileName() + Constants.PhotoExtension; string thumbPath = ImagesProcessor.GetPhoneImage(photo.Photo, fileName, new Size(193, 410)); string thumbUrl = Url.Content(thumbPath); HttpResponseMessage response; try { await _photoService.AddPhonePhoto(phoneId, thumbUrl); response = Request.CreateResponse(HttpStatusCode.OK, thumbUrl); } catch (Exception e) { Debug.WriteLine(e); response = Request.CreateResponse(HttpStatusCode.InternalServerError, e.Message); } return(response); }