public async Task <HttpResponseMessage> Post(TodoListInput list) { int id = 0; int.TryParse(User.Identity.Name, out id); await _userTaskService.CreateUserTask(id, list.Name); return(Request.CreateResponse(HttpStatusCode.OK, new TodoListDisplay() { Name = list.Name, Id = id })); }
public HttpResponseMessage Post(TodoListInput list) { var entity = new TodoList() { Name = list.Name, Owner = LoadUser() }; _repo.Store(entity); return(Request.CreateResponse(HttpStatusCode.OK, new TodoListDisplay() { Name = entity.Name, Id = entity.Id })); }
public async Task <int> CreateTodoList(TodoListInput input) { var finishOnHighPriority = false; var finishOnAllPriority = false; //Resolve configuration switch (input.TaskConfig) { case "High": finishOnHighPriority = true; break; case "All": finishOnAllPriority = true; break; } var project = _projectManager.GetProject(input.ProjectId); var list = ToDoList.CreateList(input.Name, input.Observations, input.StartDate, input.EndDate, 0, finishOnAllPriority, finishOnHighPriority, project, 0, input.AllowTodoSelection, null); var id = _toDoListManager.CreateList(list); var projectMembers = await _membersManager.GetAllMembers(input.ProjectId); foreach (var projectMember in projectMembers) { await _projectNotificationSubscriptionService.RegisterToGeneralNotifications(project, projectMember.Id); } //Overkill and unnecessary //var listMembers = input.Members.Select(memberInput => new UserTaskListIdentity() //{ // IsLeader = memberInput.Leader, // TaskListId = id, // UserId = memberInput.UserId //}).ToList(); //_toDoListManager.AddUsersToList(id, listMembers); //Register the members to all the notifications of the current list //then notifies all //await ProcessNotifications(id,listMembers); return(id); }