public IActionResult Get() { try { var users = _userMasterService.GetAsync().Result; return(Ok(users)); } catch (Exception ex) { return(BadRequest(ex)); } }
public IActionResult Get() { var states = stateServ.GetAsync().Result; var depts = deptServ.GetAsync().Result; // anonymous types C# 3.0 // var response = new { states = states, depts = depts }; var response = new StateDept() { States = states.ToList(), Depts = depts.ToList() }; return(Ok(response)); }