Exemplo n.º 1
0
        public async Task <IActionResult> Update([Required] string id)
        {
            var result = await _services.GetAsync(id);

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

            return(result.IsValid
                ? View(_mapper.Map <TravelViewModel>(result.Result))
                : _oops.OutPutError("Travel", "Index", result.ErrorsList));
        }
Exemplo n.º 3
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));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Get([Required] string id)
        {
            var result = await _services.GetAsync(id);

            if (result.IsValid)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }