public ActionResult <Arrays> Arrays(Arrays array) { if (string.IsNullOrWhiteSpace(array.What) || (array.Numbers == null)) { return new Arrays { Error = "Please provide what to do with the numbers!" } } ; if (array.What.Equals("sum")) { return new Arrays { Result = frontendServices.Sum(array.Numbers) } } ; if (array.What.Equals("multiply")) { return new Arrays { Result = frontendServices.Multiply(array.Numbers) } } ; if (array.What.Equals("double")) { return new Arrays { Result = frontendServices.Double(array.Numbers) } } ; return(BadRequest("Invalid operation.")); } } }