public async Task <ActionResult> Delete(int?id)
        {
            if (await Service.GetAsync(id) == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            return(View(AutoMapper.Mapper.Map <SportViewModel>(await Service.GetAsync(id))));
        }
示例#2
0
        public async Task <IActionResult> GetAsync(int id)
        {
            var response = await _sportService.GetAsync(id);

            if (!response.Success && response.Error.Status == 404)
            {
                return(NotFound(response.Error));
            }

            if (!response.Success)
            {
                return(BadRequest(response.Error));
            }

            return(Ok(response.Result));
        }
示例#3
0
 public async Task <IActionResult> Index()
 {
     return(Ok(await _service.GetAsync()));
 }