Exemplo n.º 1
0
        public async Task <IActionResult> GetById([Required] int id)
        {
            try
            {
                // Dummy search result - this would normally be replaced by another service call, perhaps to a database
                var customObject = await _valueService.Get(id);

                var formattedCustomObject = JsonConvert.SerializeObject(customObject, Formatting.Indented);

                return(Ok(formattedCustomObject));
            }
            catch (KeyNotFoundException)
            {
                Response.Headers.Add("x-status-reason", $"No resource was found with the unique identifier '{id}'.");
                return(NotFound());
            }
        }
Exemplo n.º 2
0
        public IActionResult Index()
        {
            var values = _ValuesService.Get();

            return(View(values));
        }
 public IResponse <GetValueResponse> Get([FromQuery] GetValueRequest request)
 {
     return(_valueService.Get(request));
 }
Exemplo n.º 4
0
 public Value Get(int id)
 {
     return(_valueService.Get(id));
 }
Exemplo n.º 5
0
        public IActionResult Get()
        {
            var user = _valueService.Get();

            return(user.Any() ? (IActionResult)Ok(user) : NotFound());
        }
Exemplo n.º 6
0
 public IActionResult ValuesServiceTest([FromServices] IValueService valueService) => View(valueService.Get());
Exemplo n.º 7
0
 public async Task <object> Get(int id)
 {
     _service.Get();
     return("value");
 }
Exemplo n.º 8
0
        public ActionResult <IEnumerable <string> > Get()
        {
            var result = _service.Get();

            return(Ok(result));
        }
Exemplo n.º 9
0
 public IActionResult Index()
 {
     return(View(_valueService.Get()));
 }
Exemplo n.º 10
0
 public async Task <IActionResult> Get()
 {
     return(Ok(await _valueService.Get()));
 }
 public async Task <ActionResult <ValueModel> > Get(int id)
 {
     return(OkOrNotFound(await _valueService.Get(id)));
 }
Exemplo n.º 12
0
 public ActionResult <IDictionary <string, object> > Get() => Ok(_service.Get());
Exemplo n.º 13
0
 public async Task GetById_InvalidId_GetsException()
 {
     var result = await _valueService.Get(5);
 }
        public IActionResult Get(int id)
        {
            ValueDto result = valueService.Get(id);

            return(result is null?NotFound() as IActionResult : Ok(result));
        }
Exemplo n.º 15
0
 public string Get(int id) => _valueService.Get(id);
Exemplo n.º 16
0
 public ActionResult <ApiSettings> Get()
 {
     return(_valueService.Get());
 }