Example #1
0
        public IActionResult Get()
        {
            try
            {
                var users = _userMasterService.GetAsync().Result;

                return(Ok(users));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
Example #2
0
        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));
        }