public async Task <IActionResult> DeleteAsset(int assetId) { var deleteServiceCommand = new DeleteAssetCommand(assetId); var result = await mediator.Send(deleteServiceCommand); return(StatusCode((int)result.Code, result.Value)); }
public async Task <IActionResult> DeleteAsset(Guid id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var command = new DeleteAssetCommand { Id = id }; return(await ExecuteRequest(command).ConfigureAwait(false)); }
public Setup() { _createAssetKeyValid = new CreateAssetCommand { Name = Guid.NewGuid().ToString(), FileURI = "key.fbx", CategoriesIds = new List <int> { 2, 4 } }; _createAssetKeyInvalid = new CreateAssetCommand { Name = "", FileURI = "" }; _updateAssetKeyValid = new UpdateAssetComamnd { Name = Guid.NewGuid().ToString(), FileURI = "key.fbx", CategoriesIds = new List <int> { 2 } }; _updateAssetKeyInvalid = new UpdateAssetComamnd { Name = "", FileURI = "" }; _deletAssetKey = new DeleteAssetCommand(); _validManagerUser = new ApplicationUser { Username = "******", Password = "******" }; _validOperatorUser = new ApplicationUser { Username = "******", Password = "******" }; _invalidUser = new ApplicationUser { Username = "******", Password = "******" }; _erroFormatUser = new ApplicationUser { Username = "", Password = "******" }; var baseTestProjectDirectory = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../")); _imgAssetValidPath = $"{baseTestProjectDirectory}TestFiles/helmet.jpg"; _imgAssetValidPath2 = $"{baseTestProjectDirectory}TestFiles/gloves2.jpg"; _imgAssetValidPath3PNG = $"{baseTestProjectDirectory}TestFiles/helmet.png"; _imgAssetInvalidFileTXT = $"{baseTestProjectDirectory}TestFiles/texto.txt"; }
public async Task <IActionResult> Delete([FromQuery] DeleteAssetCommand request) { var response = await _mediator.Send(request); return(Ok(response)); }