示例#1
0
 public async Task <IActionResult> Create([FromForm] CreateUpdatePostViewModel viewModel)
 {
     return(await Validation_EmailConfirmation_ModelState(User, ModelState, async (user) => {
         viewModel.UserId = user.Id;
         viewModel.Extension = Path.GetExtension(viewModel.File.FileName);
         var postId = postBehaviour.Create(viewModel);
         string extension = await photoManager.SavePostPhoto($"{postId}", viewModel.File);
         if (extension == null)
         {
             return Conflict("Could not save the file");
         }
         return StatusCode(201);
     }));
 }