Exemple #1
0
        public async Task <IActionResult> Reply(int id, string comment)
        {
            try
            {
                var assignment = await _databaseDriver.GetAssignmentById(id);

                var newComment = new Comment()
                {
                    CommentID      = random.Next(10000),
                    CommentContent = comment,
                    CreationTime   = DateTime.Now,
                };

                await _databaseDriver.AddNewComment(id, newComment);

                return(RedirectToAction("Task", new { id = id }));
            }
            catch (Exception)
            {
                return(View("../Shared/Error", new ErrorViewModel {
                    Message = "Comment cannot be added"
                }));
            }
        }