public ActionResult <string> Reverse(int[] productIds) { try { if (productIds != null && productIds.Count() > 0) { ArrayOperator arrayOperator = new ArrayOperator(); //Reversing the array arrayOperator.Reverse(productIds); //Returns the reversed array return(Content($"[{string.Join(",", productIds)}]")); } else { return(Content(string.Empty)); } } catch (Exception ex) { return(BadRequest("Sorry! An error occurred while reversing the product!\nError:" + ex.Message)); } }