Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            var projectDocument = _projectDocumentRepository.Get(id);

            _projectDocumentRepository.Delete(projectDocument);
            _unitOfWork.Commit();
            return(RedirectToAction("Details", "Projects", new { Id = projectDocument.ProjectId }));
        }
        public ActionResult <ProjectDocument> DeleteProjectDocumentDTO(int id)
        {
            var projectDocumentDTO = _projectDocumentRepository.Find(id);

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


            _projectDocumentRepository.Delete(id);
            _projectDocumentRepository.Save();

            return(Ok());
        }
        public ActionResult Delete(int id)
        {
            if (id > 0)
            {
                ProjectDocument doc = projectDocumentRepository.GetById(id);
                projectDocumentRepository.Delete(doc);
                projectDocumentRepository.SaveChanges();

                TempData["IsSuccess"] = true;
                TempData["Message"]   = "Документ успешно удален!";
            }
            else
            {
                TempData["IsSuccess"] = false;
                TempData["Message"]   = "Произошла ошибка, пожалуйста повторите попытку!";
            }

            return(RedirectToAction("Index"));
        }