False CS0184 warning on actionResult

75 Views Asked by At

I wrote a piece of code in c# and I have a warning that I can't avoid and don't understand. first my code :

private async Task<ActionResult<List<string>>> UpdateImagesInBlob(List<BlobImage>? origin, List<BlobImage>? goal)
{
    if (origin is null && goal is null)
        return new BadRequestObjectResult("Update BlobImage Error");
    if (goal is null)
    {
        var deleteOnlyResult = await RemoveImagesInBlob(origin!);
        return deleteOnlyResult;
    }
    else if (origin is null)
    {
        var addOnlyResult = await AddImagesInBlob(goal);
        return addOnlyResult;
    }
    var toDelete = origin.Where(im => !goal.Contains(im)).ToList();
    var toAdd = goal.Where(im => !origin.Contains(im)).ToList();
    IActionResult addResult, deleteResult;
    addResult = await AddImagesInBlob(toAdd);
    deleteResult = await RemoveImagesInBlob(toDelete);
    if (addResult is OkObjectResult && deleteResult is OkObjectResult)
        return new OkObjectResult(addResult);
    else
        return new BadRequestObjectResult("Update BlobImage Error");

}

(the code is not finished)

I use it like this :

 var imageUpdateResult = await UpdateImagesInBlob(current.Images, new.Images);
    if (imageUpdateResult is OkObjectResult)

I have a compilation warning Compiler Warning (level 1) CS0184

where is my issue ? my code return okObjectResult on success (addimageinblob and removeimageinblob return okObjectResult)

Is their something I missed ?

0

There are 0 best solutions below