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)))); }
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)); }
public async Task <IActionResult> Index() { return(Ok(await _service.GetAsync())); }