//bætir kommenti hjá bók
        public void AddReview(ReviewInputModel r)
        {
            var review = new Review
            {
                BookId      = r.BookId,
                CommentText = r.CommentText,
                Stars       = r.Stars,
                UserId      = r.UserId,
                UserName    = r.UserName,
                time        = DateTime.Now
            };

            db.Add(review);
            db.SaveChanges();
        }
Esempio n. 2
0
        public async Task <IActionResult> SignVelo([Bind("IDVelo", "Commentaire", "Email")] Models.SignVelo signVelo)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _context.Add(signVelo);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            }
            catch (DbUpdateException /* ex */)
            {
                //Log the error (uncomment ex variable name and write a log.
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists " +
                                         "see your system administrator.");
            }
            return(View(signVelo));
        }