Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("id,Description,DateCreation,DateEcheance,Terminee")] Tache tache)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tache);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tache));
        }
Ejemplo n.º 2
0
        public bool CreateList(List list)
        {
            try
            {
                _context.Add(list);
                _context.SaveChanges();
            }
            catch (DbUpdateException)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> CreationGroupee([Bind("Id,Description,DateEcheance")] List <Tache> taches)
        {
            if (ModelState.IsValid)
            {
                foreach (var tache in taches)
                {
                    tache.DateCreation = DateTime.Now;
                    _context.Add(tache);
                }

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View("CreationGroupee", taches));
        }
Ejemplo n.º 4
0
        public void Add(CategoryCreateUpdateDto category)
        {
            var result = mapper.Map <Category>(category);

            todoListContext.Add(result);
            todoListContext.SaveChanges();
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Create([Bind("DueDate,Title,Description")] TodoItem todo)
        {
            todo.DoneDate = DateTime.Now;
            todo.Done     = false;
            _context.Add(todo);
            await _context.SaveChangesAsync();

            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> Create([Bind("Id,Title,AddedDate,FinishedDate,Descripion,Priority")] TodoLists todoLists)
        {
            if (ModelState.IsValid)
            {
                _context.Add(todoLists);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(todoLists));
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> Create([Bind("Descripcion")] Tarea tarea)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tarea);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tarea));
        }
        public async Task <IActionResult> Create([Bind("Id,Description,DueDate,Complete,IdNetUsers")] TodoItem todoItem)
        {
            if (ModelState.IsValid)
            {
                _context.Add(todoItem);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdNetUsers"] = new SelectList(_context.TodoItem, "Id", "Description", todoItem.IdNetUsers);
            return(View(todoItem));
        }
Ejemplo n.º 9
0
        public void InsertNewTask(string taskName)
        {
            var newTodoTask = new TodoTask()
            {
                Title   = taskName,
                Created = DateTime.UtcNow
            };

            CustomizeTask(newTodoTask);

            _dbContext.Add(newTodoTask);
            _dbContext.SaveChanges();
        }