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)); }
public void Post([FromBody] Quote quote) { _quoteContext.Quotes.Add(quote); _quoteContext.SaveChanges(); }
public IActionResult Post([FromBody] Quote quote) { _quotesDbContext.Quotes.Add(quote); _quotesDbContext.SaveChanges(); return(Ok("The item has been Created! ")); }
public void Add(Quote quote) { _ctx.Quotes.Add(quote); _ctx.SaveChanges(); }
public IActionResult Post([FromBody] Quote quote) { _quoteDbContext.Quotes.Add(quote); _quoteDbContext.SaveChanges(); return(StatusCode(StatusCodes.Status201Created, "Quote created")); }