示例#1
0
        public IActionResult Post([FromBody] Quote value)
        {
            var userId = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value;

            value.UserId = userId;
            _quotesDbContext.Quotes.Add(value);
            _quotesDbContext.SaveChanges();
            return(StatusCode(StatusCodes.Status201Created));
        }
        public IActionResult enterQuote(Quotes quotes)
        {
            if (ModelState.IsValid)
            {
                _context.Quotes.Add(quotes);
                _context.SaveChanges();
            }

            return(View("Confirmation", quotes));
        }
        public IActionResult Quote(PostQuote model, string returnUrl = null)
        {
            ViewData["ReturnUrl"] = returnUrl;
            if (ModelState.IsValid)
            {
                _db.Quotes.Add(model);
                _db.SaveChanges();

                return(RedirectToAction(nameof(HomeController.Index), "Home"));
            }

            return(View(model));
        }
示例#4
0
 public void Post([FromBody] Quote quote)
 {
     _quoteContext.Quotes.Add(quote);
     _quoteContext.SaveChanges();
 }
示例#5
0
 public IActionResult Post([FromBody] Quote quote)
 {
     _quotesDbContext.Quotes.Add(quote);
     _quotesDbContext.SaveChanges();
     return(Ok("The item has been Created! "));
 }
示例#6
0
 public void Add(Quote quote)
 {
     _ctx.Quotes.Add(quote);
     _ctx.SaveChanges();
 }
示例#7
0
 public IActionResult Post([FromBody] Quote quote)
 {
     _quoteDbContext.Quotes.Add(quote);
     _quoteDbContext.SaveChanges();
     return(StatusCode(StatusCodes.Status201Created, "Quote created"));
 }