public async Task <IHttpActionResult> ActiveMachineById([FromUri] int id) { { //check if model is valid if (!ModelState.IsValid) { return(BadRequest(ModelState)); } //instantiate the service MachineService service = CreateMachineService(); if (await service.ActiveMachineById(id) == false) { return(InternalServerError()); } return(Ok("Active Status Updated")); //200 with custom message } }