public ActionResult DeleteConfirmed(int id)
        {
            ContactFormModel contactForm = _contactRepository.GetWhere(x => x.Id == id).FirstOrDefault();

            _contactRepository.Delete(contactForm);

            return(RedirectToAction("Index"));
        }
示例#2
0
        // GET: ContactForms/Delete/5
        public ActionResult Delete(int id)
        {
            // TODO: Add delete logic here
            var ContactForm = _repo.FindById(id);

            if (ContactForm == null)
            {
                return(NotFound());
            }

            var isSuccess = _repo.Delete(ContactForm);

            if (!isSuccess)
            {
                return(BadRequest());
            }
            return(RedirectToAction(nameof(Index)));
        }
 public void Delete(int Id)
 {
     _repo.Delete(Id);
 }