public IActionResult UploadAvatarImage([FromForm] UploadFileFormRequest request) { var user = UserService.Get(long.Parse(User.Identity.Name)); if (user == null) { return(NotFound(new ResponseModel { Success = false, Message = "Пользователь не найден" })); } var file = FileService.SaveFileForm(request.File); file.Wait(); user.Photo = file.Result; UserService.Update(user); return(Ok(new DataResponse <FileViewModel> { Data = new FileViewModel(user.Photo) })); }
public async Task <IActionResult> UploadFileForm([FromForm] UploadFileFormRequest request) { var file = await FileService.SaveFileForm(request.File); return(Ok(new DataResponse <FileViewModel> { Data = new FileViewModel(file) })); }