public IActionResult UpdateCompletion(int Id)
        {
            ToDos toUpdate = _context.ToDos.Where(x => x.Id == Id).ToList()[0];

            toUpdate.Completed = !toUpdate.Completed;
            _context.SaveChanges();

            return(RedirectToAction("ViewToDos"));
        }
        public IActionResult DeleteItem(int Id)
        {
            //Passes the appropraite ToDo into the view, as well as storing the Id in temp data
            ToDos toUpdate = _context.ToDos.Where(x => x.Id == Id).ToList()[0];

            TempData["Id"] = toUpdate.Id;

            return(View(toUpdate));
        }
Beispiel #3
0
 public Person(Person previousPerson)
 {
     HolderOrSubtantialOwner = previousPerson.HolderOrSubtantialOwner;
     OrgOrIndividual         = previousPerson.OrgOrIndividual;
     PersonId  = string.Empty;
     BirthDate = string.Empty;
     SCV       = string.Empty;
     ToDos.AddRange(previousPerson.ToDos);
 }
        public ToDos GetById(int Id)
        {
            ToDos  toDo         = new ToDos();
            string sqlStatement = "SELECT * FROM ToDoList WHERE Id=@Id";

            toDo = _sqlConnection.QueryFirstOrDefault <ToDos>(sqlStatement, new { Id = Id });

            return(toDo);
        }
Beispiel #5
0
        public void AddToDo(ToDos a)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(ToDos));

            using (TextWriter tw = new StreamWriter(@"C:\Users\Test\Documents\fox\greenfox\pontiac1-1\week-07\day-4\ToDo\ToDo\SavedToDos\" + a.Content + ".xml"))
            {
                serializer.Serialize(tw, a);
            }
        }
Beispiel #6
0
        private void InsertToDo(ToDo td)
        {
            if (ToDos == null)
            {
                LoadToDos();
            }

            ToDos.Add(td);
            SaveToDos();
        }
Beispiel #7
0
        private void RefreshList()
        {
            ToDos.Clear();
            var query = database.GetItems <ToDoItem>().OrderByDescending(c => c.Created);

            foreach (var item in query)
            {
                ToDos.Add(item);
            }
        }
Beispiel #8
0
        private void DeleteToDo(string name)
        {
            if (ToDos == null)
            {
                return;
            }

            ToDos.Remove(ToDos.First(x => x.Name == name));
            SaveToDos();
        }
Beispiel #9
0
        public IActionResult Delete(ToDos td)
        {
            if (ModelState.IsValid)
            {
                _myTasksDB.ToDos.Remove(td);
                _myTasksDB.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
Beispiel #10
0
 public void AddToDo(ToDos a)
 {
     using (_context)
     {
         _context.ToDo.Add(new ToDos {
             Content = a.Content, Priority = a.Priority
         });
         _context.SaveChanges();
     }
 }
 public ActionResult Edit([Bind(Include = "Id,Created,Action,Note,Status,Due")] ToDos toDos)
 {
     if (ModelState.IsValid)
     {
         db.Entry(toDos).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(toDos));
 }
Beispiel #12
0
        /// <summary>
        /// Asks user for the Team member, desciption of task, and the due date.
        /// Will add this task to the end of the list.
        /// </summary>
        /// <param name="member"></param>
        /// <param name="description"></param>
        /// <param name="date"></param>
        public void CreateTask(string member, string description, string date)
        {
            ToDo tazk = new ToDo();

            tazk.Member      = member;
            tazk.Description = description;
            tazk.Date        = date;

            ToDos.Add(tazk);
        }
        public ActionResult Create([Bind(Include = "Id,Created,Action,Note,Status,Due")] ToDos toDos)
        {
            if (ModelState.IsValid)
            {
                db.ToDos.Add(toDos);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(toDos));
        }
Beispiel #14
0
 public ToDos GetToDo(int id)
 {
     foreach (ToDos todo in ToDoList)
     {
         if (id == todo.Id)
         {
             Todos = todo;
         }
     }
     return(Todos);
 }
        public ActionResult Add(ToDoMvcViewModel item)
        {
            ToDos data = new ToDos()
            {
                Id = _toDoRepository.GetUniqueId(),
                ToDoDescription = item.Description,
                Status          = 0
            };

            _toDoRepository.Add(data);
            return(RedirectToAction("Index", new { status = _status }));
        }
Beispiel #16
0
        public async Task <IActionResult> PostToDos([FromBody] ToDos todos)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.ToDos.Add(todos);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetToDos", new { id = todos.ToDoID }, todos));
        }
Beispiel #17
0
        private void SaveCancel_Speichern(object sender, RoutedEventArgs e)
        {
            ToDos toDos = new ToDos();

            toDos.Bezeichnung  = this.bezeichnung.Text;
            toDos.Kategorie_Nr = ((ToDoKategorien4Dropdown)this.kategorien.SelectedItem).Nummer;
            toDos.Cosplan_Nr   = this.cosplan_nr;
            toDos.Save(ApS.Databases.SqlAction.Insert);

            this.Saved = true;
            this.Close();
        }
Beispiel #18
0
        void ExecuteDelete(ToDoDetailModel item)
        {
            ToDoDetailModel toDo = _getRealmInstance.All <ToDoDetailModel>().First(x => x.Id == item.Id);

            using (Transaction transaction = _getRealmInstance.BeginWrite())
            {
                _getRealmInstance.Remove(toDo);
                transaction.Commit();
            }

            ToDos.Remove(item);
        }
Beispiel #19
0
        private void frmToDos_Load(object sender, EventArgs e)
        {
            Does = new ToDos();
            var t1 = Does.Add("Examen de desarrollo");
            var t2 = Does.Add("practica");
            var t3 = Does.Add("practica 3");

            Does.Do(t3);
            refreshPendingData();
            refreshDoneData();
            sbStatus.Text = "Datos cargados correctamente";
        }
Beispiel #20
0
        public JsonResult Add(string description)
        {
            ToDos data = new ToDos()
            {
                Id = _toDoRepository.GetUniqueId(),
                ToDoDescription = description,
                Status          = 0
            };

            _toDoRepository.Add(data);
            return(Json(data));
        }
Beispiel #21
0
        public IActionResult Test(int id, string newContent, bool newPriority)
        {
            using (_context)
            {
                ToDos toUpdate = _context.ToDo.FirstOrDefault(td => td.ID == id);
                toUpdate.Content  = newContent;
                toUpdate.Priority = newPriority;
                _context.SaveChanges();
            }

            return(Redirect("Test"));
        }
Beispiel #22
0
        public ActionResult AddNewTask(string taskName, int?cid)
        {
            ToDos td = new ToDos()
            {
                CategoryId = (int)cid,
                Tittle     = taskName
            };

            db.ToDos.Add(td);
            db.SaveChanges();

            return(PartialView("~/Views/Partial/AddTask.cshtml", td));
        }
        public IActionResult DeleteItem(string option)
        {
            if (option.Equals("yes"))
            {
                //Messy implementation, but this re-grabs the ToDo using the Id in temp data. Then, removes the ToDo and saves changes
                //Not sure if there is a cleaner way to cast the temp data Id to an int, but I'd love to know if there is.
                ToDos toDelete = _context.ToDos.Where(x => x.Id == int.Parse(TempData["Id"].ToString())).ToList()[0];
                _context.ToDos.Remove(toDelete);
                _context.SaveChanges();
            }

            return(RedirectToAction("ViewToDos"));
        }
Beispiel #24
0
        void ExecuteAdd()
        {
            ToDoDetailModel toDo = new ToDoDetailModel();

            toDo.Id           = Guid.NewGuid().ToString();
            toDo.Detail       = Detail;
            toDo.CreationDate = DateTime.Now.ToString();
            toDo.ModifiedDate = DateTime.Now.ToString();
            _getRealmInstance.Write(() => {
                _getRealmInstance.Add(toDo);
            });
            ToDos.Add(toDo);
        }
Beispiel #25
0
        private void LoadToDos()
        {
            this.todos.Children.Clear();

            using (ToDos toDos = this.core.GetToDos(this.cosplan.Nummer))
            {
                int kategorie   = 0;
                int columnCount = 9;
                //hier "Tabellenkoepfe" fuer Kategorien einfuegen
                while (!toDos.EoF)
                {
                    if (kategorie != toDos.Kategorie_Nr)
                    {
                        kategorie = toDos.Kategorie_Nr;

                        Grid header = new Grid
                        {
                            Background = Brushes.Transparent,
                            Height     = 20
                        };

                        for (int i = 0; i <= columnCount; i++)
                        {
                            header.ColumnDefinitions.Add(new ColumnDefinition());
                        }
                        this.CreateTableHeader(header, kategorie);
                        this.todos.Children.Add(header);
                    }
                    GridExtended grid = new GridExtended
                    {
                        Background = Brushes.Transparent,
                        Height     = 50
                    };
                    grid.MouseEnter    += Grid_MouseEnter;
                    grid.MouseLeave    += Grid_MouseLeave;
                    grid.MouseUp       += Grid_MouseUp;
                    grid.EditCompleted += Grid_EditCompleted;

                    for (int i = 0; i <= columnCount; i++)
                    {
                        grid.ColumnDefinitions.Add(new ColumnDefinition());
                    }

                    this.ActualizeSingleToDoRow(grid, toDos);

                    this.todos.Children.Add(grid);
                    toDos.Skip();
                }
            }
        }
        // GET: ToDos/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ToDos toDos = db.ToDos.Find(id);

            if (toDos == null)
            {
                return(HttpNotFound());
            }
            return(View(toDos));
        }
Beispiel #27
0
        public IActionResult Update(ToDos td)
        {
            if (ModelState.IsValid)
            {
                //updating user record
                string user = User.FindFirst(ClaimTypes.NameIdentifier).Value;
                td.UserId     = user;
                td.IsComplete = true;
                _myTasksDB.ToDos.Update(td);
                _myTasksDB.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
Beispiel #28
0
 public IActionResult Create(ToDos task)
 {
     task.UserId = User.FindFirst(ClaimTypes.NameIdentifier).Value;
     if (ModelState.IsValid)
     {
         _myTasksDB.ToDos.Add(task);
         _myTasksDB.SaveChanges();
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View());
     }
 }
        public ActionResult Update(int Id)
        {
            ToDos data = _toDoRepository.GetById(Id);

            if (data.Status == 1)
            {
                data.Status = 0;
            }
            else
            {
                data.Status = 1;
            }
            _toDoRepository.Update(data);
            return(RedirectToAction("Index", new { status = _status }));
        }
Beispiel #30
0
        public JsonResult Update(int Id)
        {
            ToDos data = _toDoRepository.GetById(Id);

            if (data.Status == 1)
            {
                data.Status = 0;
            }
            else
            {
                data.Status = 1;
            }
            _toDoRepository.Update(data);
            return(Json(data));
        }