public async Task <IActionResult> EditPost(UserTask userTask) { if (userTask == null) { return(NotFound()); } UserTaskForUpdateDTO userTaskUpdate = new UserTaskForUpdateDTO(); userTaskUpdate.UserID = userTask.UserID; userTaskUpdate.Title = userTask.Title; userTaskUpdate.Description = userTask.Description; userTaskUpdate.IsDone = userTask.IsDone; var userTaskSerialize = JsonConvert.SerializeObject(userTaskUpdate); var user = await _userManager.GetUserAsync(User); if (user == null) { throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); } _webAPI.AssignAuth(user.UserName); await _webAPI.PutRequest(userTask.UserTaskID.ToString(), userTaskSerialize); return(RedirectToAction(nameof(Index))); }