Exemplo n.º 1
0
        public async Task <IActionResult> MarkDone(Guid id)
        {
            if (id == Guid.Empty)
            {
                return(RedirectToAction("Index"));
            }

            //Obtiene el usuario actul
            var currentUser = await _userManager.GetUserAsync(User);

            //Verifica que halla un usuario logeado,
            //en caso contrario fuerza el logeo con Challenge().
            if (currentUser == null)
            {
                return(Challenge());
            }

            var successful = await _todoItemService.MarkDoneAsync(id, currentUser);

            if (!successful)
            {
                return(BadRequest("Could not mark item as done."));
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> MarkDone(Guid id)
        {
            if (id == Guid.Empty)
            {
                return(RedirectToAction("Index"));
            }
            var successful = await _toDoItemService.MarkDoneAsync(id);

            if (!successful)
            {
                return(BadRequest("Could not mark item as done."));
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> MarkDone(Guid id)
        {
            if (id == Guid.Empty)
            {
                return(BadRequest());
            }

            var succesfull = await _toDoItemService.MarkDoneAsync(id);

            if (!succesfull)
            {
                return(BadRequest(new { error = "could not mark item as done" }));
            }
            return(Ok());
        }
Exemplo n.º 4
0
        public async Task <IActionResult> MarkDone(Guid id)
        {
            if (id == Guid.Empty)
            {
                return(BadRequest());
            }

            var currentUser = await _userManager.GetUserAsync(User);

            if (currentUser == null)
            {
                return(Unauthorized());
            }

            var sucessful = await _todoItemsService
                            .MarkDoneAsync(id, currentUser);

            return(Ok());
        }
Exemplo n.º 5
0
        public async Task <IActionResult> MarkDone(Guid id)
        {
            //Func<IActionResult> redirect = () => RedirectToAction("Index");

            IActionResult redir()
            {
                return(RedirectToAction("Index"));
            }

            if (id == Guid.Empty)
            {
                return(redir());
            }

            if (!await _toDoItemService.MarkDoneAsync(id))
            {
                return(BadRequest("Bad Request, cou not mark it done."));
            }

            return(redir());
        }
Exemplo n.º 6
0
        public async Task <IActionResult> MarkDone(Guid id)
        {
            if (id == Guid.Empty)
            {
                return(RedirectToAction("Index"));
            }
            var currentUser = await _userManager.GetUserAsync(User);

            if (currentUser == null)
            {
                return(Challenge());
            }
            var successful = await _toDoItemService
                             .MarkDoneAsync(id, currentUser);

            if (!successful)
            {
                return(BadRequest("Could not mark item as done."));
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> MarkDone(Guid id)
        {
            var currentUser = await _userManager.GetUserAsync(User);

            if (currentUser == null)
            {
                return(Unauthorized());
            }

            if (id == Guid.Empty)
            {
                return(BadRequest());
            }

            var succesfull = await _toDoItemService
                             .MarkDoneAsync(id, currentUser);

            if (!succesfull)
            {
                return(BadRequest(
                           new { error = "Could not mark item as done" }));
            }
            return(Ok());
        }