Пример #1
0
        public async Task <IdentityResult> CreateAsync(Role role, CancellationToken cancellationToken)
        {
            db.Add(role);

            await db.SaveChangesAsync(cancellationToken);

            return(await Task.FromResult(IdentityResult.Success));
        }
Пример #2
0
        public IActionResult Post([FromBody] Alpha a)
        {
            _context.Add(a);

            _context.SaveChanges();

            return(CreatedAtRoute(new { id = a.Id }, a));
        }
        public async Task <IActionResult> Create([Bind("Id,LastName,FirstName,Age,City")] Persons persons)
        {
            if (ModelState.IsValid)
            {
                _context.Add(persons);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(persons));
        }
        public async Task <IActionResult> Create([Bind("EmpID,EmpLastName,EmpFirstName,EmpOrganization,EmpCity")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
Пример #5
0
        public async Task <IActionResult> Create([Bind("Id,Name,Rate")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync(User?.FindFirst(ClaimTypes.NameIdentifier)?.Value);

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