Exemple #1
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                repComments.Delete(id);
                // TODO: Add delete logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemple #2
0
        public ActionResult DeleteComment(int id)
        {
            if (AuthenticationManager.LoggedUser == null)
            {
                return(RedirectToAction("Login", "Home"));
            }

            CommentsRepository commentsRepository = new CommentsRepository(new TaskManagerDb());
            Comment            comment            = commentsRepository.GetById(id);

            commentsRepository.Delete(comment);

            return(RedirectToAction("TaskDetails", "TasksManager", new { id = comment.TaskId }));
        }
Exemple #3
0
        internal Comment Delete(int id, string userId)
        {
            Comment found = Get(id);

            if (found.AuthorId != userId)
            {
                throw new Exception("Invalid Request");
            }
            if (_repo.Delete(id))
            {
                return(found);
            }
            throw new Exception("Something went terribly wrong");
        }
        public async Task <Comments> DeleteComment(int id)
        {
            var entity = _comments.ReadById(id).Result;

            return(await _comments.Delete(entity));
        }
Exemple #5
0
 internal string Delete(int id, string userId)
 {
     GetById(id);
     _repo.Delete(id, userId);
     return("Comment Deleted");
 }