Exemplo n.º 1
0
        public async Task <IActionResult> AddToDotaskAsync([FromBody] TodoTask todoTask)
        {
            var userName = ((ClaimsIdentity)User.Identity).FindFirst(ClaimTypes.Name).Value;

            todoTask.UserName = userName;

            var response = await _SqlService.AddTodoTaskAsync(todoTask);

            if (response == true)
            {
                return(Ok(new Response {
                    Status = "Success", Message = "Sucessfully added task"
                }));
            }
            else
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, new Response {
                    Status = "Error", Message = "Task creation failed, please try again."
                }));
            }
        }