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));
        }
Example #2
0
 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"));
 }
Example #3
0
 public async Task Add(Quote quote)
 {
     await _repository.Create(quote);
 }