public ActionResult <string> Get() { _taskManager.Add(new Task() { Name = "Juan" }); return("Hola Mundo"); }
public void InitializeDomainFromDatabase( ITaskItemRepositoryFactory taskItemRepositoryFactory, INotificationManager notificationManager, ITaskManager taskManager, IClock clock) { /* * hook up to notfication added event now, so to retrieve new notifications generated by * the TaskItems being created below */ notificationManager.NotificationAdded += OnNotificationAdded; /* * read in task items from database. Create domain taskItems from * data and add items to taskManager */ ITaskItemRepository taskItemRepository = taskItemRepositoryFactory.New(); foreach (TaskItemDAL task in taskItemRepository.GetAll()) { INotificationFrequency notificationFrequency = null; if (task.customNotificationFrequency.HasValue) { CustomNotificationFrequencyDAL frequencyDAL = task.customNotificationFrequency.Value; notificationFrequency = NotificationFrequencyFactory.New( //TODO: do something safer than just a cast (NotificationFrequencyType)task.notificationFrequencyType, frequencyDAL.time ); } else { notificationFrequency = NotificationFrequencyFactory.New( //TODO: do something safer than just a cast (NotificationFrequencyType)task.notificationFrequencyType ); } taskManager.Add( new TaskItem( task.title, task.description, new Colour(task.r, task.g, task.b), task.startTime, notificationManager, notificationFrequency, clock, task.lastNotificationTime, task.id ) ); } }
void AddTask() { Console.Write("Enter Title:"); string name = Console.ReadLine(); Console.Write("Enter Description:"); string descr = Console.ReadLine(); var taskModel = new TaskModel { Title = name, Description = descr }; _taskManager.Add(taskModel); Console.WriteLine("New task was successfuly added"); }
public static async Task ApplyChanges(this ITaskManager manager, TaskEditingState state) { foreach (var task in state.AddedTasks) { await manager.Add(task).ConfigureAwait(false); } foreach (var task in state.ModifiedTasks) { await manager.Update(task).ConfigureAwait(false); } foreach (var task in state.RemovedTasks) { await manager.Remove(task).ConfigureAwait(false); } }
private static void NewProcess(ITaskManager taskManager) { Console.WriteLine("Please select priority : 1 for Low / 2 for Medium / 3 for High"); var priorityStr = Console.ReadLine(); if (ValidateEnumInput(priorityStr)) { var priorityId = int.Parse(priorityStr); var newProcess = taskManager.Add(new ProcessDto((Priority)priorityId)); var outputMessage = newProcess != null ? $"New process added. {newProcess.ToString()}" : "Task manager is full.Process can't be added."; Console.WriteLine(outputMessage); } else { Console.WriteLine("Invalid value for priority."); } }
public async void Post([FromBody] BaseTask task) { await repository.Add(task); manager.Add(task, tasksFactory.SendMessageAction); }