public IHttpActionResult Get() { var vm = new PTCViewModel(); vm.LoadSearchCategories(); if (vm.SearchCategories.Count > 0) { return(Ok(vm.SearchCategories)); } else { return(NotFound()); } }
public IHttpActionResult GetSearchCategories() { IHttpActionResult ret = null; PTCViewModel vm = new PTCViewModel(); vm.LoadSearchCategories(); if (vm.SearchCategories.Count > 0) { ret = Ok(vm.SearchCategories); } else { ret = NotFound(); } return(ret); }
public IHttpActionResult GetSearchCategories() { IHttpActionResult ret; PTCViewModel vm = new PTCViewModel(); vm.LoadSearchCategories(); if (vm.SearchCategories.Count() > 0) { ret = Ok(vm.SearchCategories); } else if (vm.LastException != null) { ret = BadRequest(vm.Message); } else { ret = NotFound(); } return(ret); }