Beispiel #1
0
        public async Task <IActionResult> Create([Bind("Id,Before,After,Url,Type,DateUpdate")] Log log)
        {
            if (ModelState.IsValid)
            {
                _context.Add(log);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(log));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("Id,Title,Credits")] Course course)
        {
            if (ModelState.IsValid)
            {
                _context.Add(course);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(course));
        }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind("Id,LastName,FirstMidName,EnrollmentDate")]
                                                 Student student)
        {
            if (ModelState.IsValid)
            {
                _context.Add(student);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            return(View(student));
        }
Beispiel #4
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Age")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                // When it is a sign up action, you can call LogService after the context has already saved the post values ​​to the database.
                _logService.Save(employee, LogType.Type.Create, HttpContext);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }