Ejemplo n.º 1
0
        public async Task <IActionResult> ConfirmDelete(int id)
        {
            var allComments = await _context.GetComments();

            var comment = allComments.FirstOrDefault(co => co.ID == id);

            await _context.Delete(comment.ID);

            return(RedirectToAction(nameof(View)));
        }
Ejemplo n.º 2
0
        public ActionResult DeleteComm(int id, string idUser, DateTime date, commentt c)
        {
            if (ModelState.IsValid)
            {
                commentt b = commSer.Get(t => t.article.idArticle == id && t.idUser.Equals(idUser) && t.date == date);

                commSer.Delete(b);
                return(RedirectToAction("Details", new { id = b.idArticle }));
            }
            else
            {
                return(View());
            }
        }
Ejemplo n.º 3
0
        public ActionResult DeleteComm(int id, commentt c)
        {
            if (ModelState.IsValid)
            {
                commentt b = commSer.GetById(id);

                commSer.Delete(b);
                return(RedirectToAction("getComment"));
            }
            else
            {
                return(View());
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 删除一个实体
 /// </summary>
 /// <param name="_entity"></param>
 /// <returns></returns>
 public int Delete(int c_id)
 {
     return(dal.Delete(c_id));
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public int Delete(int Id)
        {
            var result = iComments.Delete(Id);

            return(result);
        }