static void Main(string[] args) { using (var db = new SQLContext()) { // Create and save a new Blog Console.Write("Enter a name for a new Blog: "); var name = Console.ReadLine(); var toDoList = new ToDoList { Title = name }; db.ToDoLists.Add(toDoList); db.SaveChanges(); // Display all Blogs from the database var query = from b in db.ToDoLists orderby b.Title select b; Console.WriteLine("All blogs in the database:"); foreach (var item in query) { Console.WriteLine(item.Title); } Console.WriteLine("Press any key to exit..."); Console.ReadKey(); } }
private async Task AddToDoAsync() { ToDoList toDoList = new ToDoList { DateCreated = DateTime.Now.Date }; todos.Add(toDoList); await JSRuntime.InvokeVoidAsync("setFocus", $"{toDoList.Id}TitleInputBig"); }
public static void ListToDo() { var aToDoList = new ToDoList(new List <ITODO>() { new ToDo1(), new ToDo2(), new ToDo3() }); }
public void should_mark_done_item() { var toDoList = new ToDoList(); var toDoItem = new ToDoItem("name1", DateTime.Now, false); toDoList.addItem(toDoItem); toDoList.markDoneItem(toDoItem); ///Assert.True(toDoList.items[)) }
private void DisplayListData(ToDoList list) { _writer.WriteLine($"Id : {list.Id}"); _writer.WriteLine($"Title : {list.Title}"); _writer.WriteLine($"IdOfCreator : {list.IdOfCreator} "); _writer.WriteLine($"DateCreated : {list.DateCreated}"); _writer.WriteLine($"LastModifiedBy : {list.LastModifiedBy}"); _writer.WriteLine($"LastModifiedAt : {list.LastModifiedAt}"); }
private void XLabel_MouseDown(object sender, MouseButtonEventArgs e) { Label selectedLabel = (Label)sender; ToDoList deletedList = (ToDoList)selectedLabel.Tag; process.RemoveToDoList(deletedList); MessageBox.Show("The list deleted successfully!"); RefreshLists(); }
/// <summary> /// Remove task from list of tasks. /// </summary> private void RemoveTask(ToDo todo) { if (todo == null) { return; } ToDoList.Remove(todo); }
public void CreateToDoListForUser(string userName, string toDoListName) { ToDoList toDoList = new ToDoList(); ApplicationUser usr = _context.Users.FirstOrDefault(x => x.UserName == userName); toDoList.refUserId = usr.Id; toDoList.ToDoListName = toDoListName; _context.ToDoLists.Add(toDoList); }
public IActionResult Update([FromBody] ToDoList todoList) { var todo = _todoListService.Get(todoList.Id); todo.Status = !todo.Status; _todoListService.Update(todoList.Id, todo); return(Json(todo)); }
public void Delete(int toDoListID) { ToDoList itemToRemove = Get(toDoListID); Models .ToDoLists .Lists[itemToRemove.UserID] .Remove(itemToRemove); }
private void setNewTask() { var toDo = new ToDo(); toDo.PropertyChanged += onToDoListIsDoneChange; toDo.TxtTask = TxtNewTask; ToDoList.Add(toDo); ToDoList = new List <ToDo>(ToDoList); }
private async Task HandleSelectedListChangedAsync(ToDoList list) { SelectedList = list; await ItemsViewModel.ShowItemsAsync(list) .ConfigureAwait(true); OnStateChanged(); }
public async Task <ActionResult <ToDoList> > CreateToDoListAsync() { var list = new ToDoList { Id = Guid.NewGuid() }; await _daprClient.SaveStateAsync(StoreName, list.Id.ToString(), list); return(list); }
public ActionResult Add(ToDoListView toDoListView, FormCollection form) { if (ModelState.IsValid) { IToDoListsRepository toDoListsRepository = new ToDoListsRepository(db); ToDoList toDoList = new ToDoList(); toDoListView.ConvertTo(toDoListView, toDoList); toDoList.UserFK = SecurityHelper.GetUserPKFromCookie(); toDoList.CreationDate = DateTime.Now; toDoListsRepository.Add(toDoList); toDoListsRepository.SaveChanges(); string[] legalEntitiesSelectedValues = new string[500]; if (form["LegalEntityPK"] != null) { legalEntitiesSelectedValues = ((string)form["LegalEntityPK"]).Split(','); } else { legalEntitiesSelectedValues = null; } IWorkDonesRepository workDonesRepository = new WorkDonesRepository(db); if (legalEntitiesSelectedValues != null) { // Add work dones foreach (string legalEntity in legalEntitiesSelectedValues) { WorkDone workDone = new WorkDone(); workDone.ToDoListFK = toDoList.ToDoListPK; workDone.LegalEntityFK = Convert.ToInt32(legalEntity); workDone.CreatedWithToDo = true; workDonesRepository.Add(workDone); } workDonesRepository.SaveChanges(); } TempData["message"] = LayoutHelper.GetMessage("INSERT", toDoList.ToDoListPK); return(RedirectToAction("Index", "ToDoList")); } else { ILegalEntitiesRepository legalEntitiesRepository = new LegalEntitiesRepository(db); toDoListView.Companies = new MultiSelectList(legalEntitiesRepository.GetValidLegalEntities().OrderBy("name ASC"), "LegalEntityPK", "Name"); return(View(toDoListView)); } }
public ActionResult Create(ToDoList ToDoList) { if (ModelState.IsValid) { db.ToDoLists.Add(ToDoList); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(ToDoList)); }
public async Task <IActionResult> Create([Bind("ID,Name,IsDone")] ToDoList toDoList) { if (ModelState.IsValid) { await APIListPost(toDoList); return(RedirectToAction("Index", "Home")); } return(View()); }
/// <summary> /// Action that makes a PUT request to the API to update the current /// ToDoList or create a new one /// </summary> /// <param name="id">Id of the ToDoList object</param> /// <param name="list">ToDoList object</param> /// <returns>Status code</returns> public async Task <HttpStatusCode> APIListPut(long id, ToDoList list) { using (var client = new HttpClient()) { client.BaseAddress = new Uri("http://eisj-todoapi.azurewebsites.net"); var response = await client.PutAsJsonAsync($"/api/todolist/{id}", list); return(response.StatusCode); } }
private async Task <bool> TaskExists(int id) { ToDoList task = await _context.GetTaskByIDAsync(id); if (task != null) { return(true); } return(false); }
public void Add(ToDoList toDoList) { ToDoListDBContext db = DBContext; var Itemslst = GetList(); int maxId = Itemslst != null && Itemslst.Count > 0 ? Itemslst.Max(x => x.Id) : 0; toDoList.Id = maxId + 1; db.ToDoList.Add(toDoList); db.SaveChanges(); }
public void When_adding_an_item_to_a_list_that_exists() { ToDoList toDoList = new ToDoList(); toDoListRepository.Setup(x => x.FindListByUserName(It.IsAny<string>(), It.IsAny<string>())).Returns(toDoList); toDoApplication.AddItemToList(USER_NAME, LIST_NAME, ITEM_NAME); Assert.IsTrue(toDoList.Items.Contains(ITEM_NAME)); toDoListRepository.Verify(x=>x.Save(toDoList)); }
public IActionResult Checkedlist(int id, ToDoList toDoList) { var put = _todolistService.Checkedlist(id, toDoList); if (put > 0) { return(Ok(put)); } return(BadRequest("Checked Failed!")); }
public void CreateToDoList() { string name = "Test todolist add"; string description = "Test todolist description"; ToDoList list = RunTest(ToDoList.Create(Api, Settings.TestProject, Settings.TestToDoSet, name, description)); Assert.AreEqual(name, list.name); Assert.AreEqual(description, list.description); list.SetStatus(Api, Status.trashed).Wait(); }
public ActionResult Edit([Bind(Include = "Id,Name,DueDate,IsReOccuring")] ToDoList toDoList) { if (ModelState.IsValid) { db.Entry(toDoList).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index"));//After an item Edited return to index Action -List } return(View(toDoList)); }
public async Task <IActionResult> Create([Bind("ID,Task,Priority,Completed,DueDate")] ToDoList item) { if (ModelState.IsValid) { await _context.CreateATaskAsync(item); return(RedirectToAction(nameof(Index))); } return(View(item)); }
public ActionResult EditList([Bind(Include = "Id,Desc")] ToDoList toDoList) { if (ModelState.IsValid) { db.ToDoLists.First(m => m.Id == toDoList.Id).Desc = toDoList.Desc; db.SaveChanges(); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
public bool ToDoListUpdate(int id, ToDoList toDoList) { if (ToDoListRemove(id)) { ToDoListAdd(toDoList); _cache.Set(Config.CacheKey.ToDoListGetAll, () => ToDoLists); return(true); } return(false); }
public async Task <int> Handle(AddToDoListCommand request, CancellationToken cancellationToken) { int userId = _userAccessor.GetUserId(); request.ToDoList.UserId = userId; var db = _instanceDB.Get <IToDoListDbManager>(); ToDoList list = _dTO.MapListDTOToAddEntity(request.ToDoList); return(await db.AddToDoList(list)); }
public ActionResult Edit([Bind(Include = "ToDoListID,Title")] ToDoList toDoList) { if (ModelState.IsValid) { db.Entry(toDoList).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(toDoList)); }
public bool Initialize_ToDoList() { if (ToDoList != null) { ToDoList.CreateTestItems(); return(true); } return(false); }
public void AddToDoList(string title, string color = "#ffffff") { if (userService.CurrentUser != null) { var list = new ToDoList(title, color); list.UserId = userService.CurrentUser.Id; unitOfWork.ToDoListRepository.Create(list); unitOfWork.Save(); } }
public void TestgetStatus() { ToDoList todoList = new ToDoList(); Tasks getstatus = new Tasks("test"); todoList.addTask(getstatus); Assert.IsTrue(todoList.getStatus("test") == true); Assert.Fail("Not implemented yet"); }
public List <ToDoList> UpdateToDoList(int id, ToDoList toDoList) { if (this.Remove(id)) { this.AddNewToDoList(toDoList); db.SaveChanges(); return(db.Books.ToList()); } return(db.Books.ToList()); }
public async Task<HttpResponseMessage> Put(Guid id, ToDoList toDoList) { await Session.StoreAsync(toDoList); return Request.CreateResponse(HttpStatusCode.Created, toDoList); }
public static void ShowWindow() { if (_toDoList != null) return; _toDoList = (ToDoList)EditorWindow.GetWindow(typeof(ToDoList)); }
public Home() { InitializeComponent(); TodoList = new ToDoList(); DisableButtons(); }