OverviewI am designing one api that will be integration with another system, however I stumbled upon one code which I know it can be improved but I don't know how to do it properly.Code    [HttpPost]    [Route(Reserve)]    public IHttpActionResult Reserve([FromUri]ReserveData reserveData, [FromBody]BetsData bet)    {        var result = new ReserveResponse();        // Question 1.        if (reserveData == null || !IsDataForReserveValid(reserveData))        {            // Question 2.            return Ok(_responseStringBuilder.BuildWrongRequestResponse().Create());        }        // Question 3.        if (!_customerService.CheckIfCustomerExists(reserveData.cust_id))        {            return Ok(_responseStringBuilder.BuildCustomerNotFoundResponse().Create());        }        if (_customerService.IsCustomerRestricted(reserveData.cust_id))        {            return Ok(_responseStringBuilder.BuildRestrictedCustomerResponse().Create());        }        if (!_reserveService.ReserveAmount(reserveData.cust_id, reserveData.amount))        {            return Ok(_responseStringBuilder.BuildInsufficientFundsResponse().Create());        }        if (bet != null)        {        }        _reserveService.InsertReserve(reserveData);        return Ok(_responseStringBuilder.BuildNoErrorsResponse().Create());    }RequirementsThis is simple action that should return Ok with string in its response content. QuestionsIs there any better what of checking for valid input? I've createdhierarchy of methods validating input of each action in thiscontroller(because most of the input for different actions is actually repeating) asprivate methods in the controller.I've created string builder pattern and I build each time my request with needed properties. Is this the best way?    There is some business logic which I've put in the controller, but I am not sure if it should be in the service layer or not Should I leave it like that or invoke single method from a service which does all the logic by itself there and simply returns result to me if there are errors or not?Example response would be:...(some data)error_code=NoErrors\r\nerror_message=There were no errors\r\n
Designing better api controller
c#;design patterns;controller;asp.net web api