Пример #1
0
        public async Task <IActionResult> Create([Bind("ID,FirstName,LastName,Birthday,BankNumber,Email,PhoneNumber,Address")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("ID,Title,Description,Status,UserID")] Models.Task task)
        {
            if (ModelState.IsValid)
            {
                _context.Add(task);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserID"] = new SelectList(_context.Users, "ID", "ID", task.UserID);
            return(View(task));
        }
Пример #3
0
 public void Add(T entity)
 {
     _userTaskContext.Add(entity);
 }