public async Task <ActionResult> UploadFile(FileCreateViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(ModelState.ToDictionary()));
            }

            var createdFile = await _filesManager.Create(model, User.Identity.GetUserId());

            return(Json(createdFile));
        }
Example #2
0
 private void UploadFile()
 {
     using (var fileService = new FileServices())
     {
         idFile = fileService.Create(securityToken, new FileDto
         {
             ContentSize = "0",
             ContentType = "image/jpeg",
             Filename    = "test.jpg"
         }, new byte[0]);
         Assert.IsTrue(idFile > 0);
     }
 }