// GET: Awards/Details/5
        public async Task <IActionResult> Details(int id)
        {
            var award = await _awardService.GetAsync(id);

            if (award == null)
            {
                return(NotFound());
            }

            return(View(award));
        }
        public async Task <IActionResult> Update([Required] string id)
        {
            var result = await _services.GetAsync(id);

            if (result.IsValid)
            {
                return(View(_mapper.Map <UpdateAwardViewModel>(result.Result)));
            }
            TempData["ErrorsList"] = result.ErrorsList;
            return(View());
        }
        public async Task <IActionResult> Update(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var result = await _services.GetAsync(id);

            return(result.IsValid
                ? View(_mapper.Map <AwardViewModel>(result.Result))
                : _oops.OutPutError("Award", "Index", result.ErrorsList));
        }
        public async Task <IActionResult> Get([Required] string id)
        {
            var result = await _services.GetAsync(id);

            if (result.IsValid)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
Пример #5
0
        public async Task <IActionResult> Get([Required] string id)
        {
            var result = await _services.GetAsync(id);

            if (result.IsValid)
            {
                return(Ok(result.Result));
            }
            return(NotFound(result.ErrorsList));
        }