public async Task <IHttpActionResult> EditUser() { HttpPostedFile userPhoto = null; if (HttpContext.Current.Request.Files.Count > 0) { userPhoto = HttpContext.Current.Request.Files[0]; } string appData = HttpContext.Current.Server.MapPath("~/App_Data"); MultipartFormDataStreamProvider provider = new MultipartFormDataStreamProvider(appData); provider = await Request.Content.ReadAsMultipartAsync(provider); if (userPhoto != null) { if (appUserService.EditUser(userPhoto.InputStream, provider) > 0) { return(Ok()); } else { return(InternalServerError()); } } else { if (appUserService.EditUser(provider) > 0) { return(Ok()); } else { return(InternalServerError()); } } }