public async Task <IActionResult> UploadImage(IFormFile file) { var resourcModel = mapper.Map <CreateResourceModel>(file); var result = await resourcesManager.CreateAsync(resourcModel); if (result.Succeed) { HttpContext.Session.SetInt32("fileId", result.Id); } return(Json(result)); }