public async Task <IActionResult> Create([Bind("Id,Description,Author")] Quote quote) { if (ModelState.IsValid) { quote.Id = Guid.NewGuid(); _quotesRepository.Create(quote); return(RedirectToAction(nameof(Index))); } return(View(quote)); }
public IActionResult Create(Quote quote) { if (ModelState.IsValid) { _quotes.Create(quote); if (IsAjaxRequest()) { return(Json("Ok")); } } if (IsAjaxRequest()) { return(Json("Not Ok")); } return(RedirectToAction("Index", "Home")); }
public async Task Add(Quote quote) { await _repository.Create(quote); }