Example #1
0
 private void removeRecursive(Section section)
 {
     if (section.ChildSections != null)
     {
         while (section.ChildSections.Any())
         {
             removeRecursive(section.ChildSections.First());
         }
     }
     if (section.Topics != null)
     {
         while (section.Topics.Any())
         {
             var topic = section.Topics.First();
             if (topic.Messages != null)
             {
                 while (topic.Messages.Any())
                 {
                     _messageRepository.Delete(topic.Messages.First().Id);
                 }
             }
             _topicRepository.Delete(topic.Id);
         }
     }
     _sectionRepository.Delete(section.Id);
 }
Example #2
0
        public ActionResult DeleteConfirmed(byte?id)
        {
            Section s = new Section {
                SectionId = id.Value
            };

            sectionRepository.Delete(s);
            return(RedirectToRoute(new { controller = "Section", Action = "Index" }));
        }
Example #3
0
        public Section DeleteSection(int id)
        {
            var section = _sectionRepository.Find(id);

            _sectionRepository.Delete(section.Id);

            _sectionRepository.Save();

            return(section);
        }
Example #4
0
        public Section Delete(long sectionId)
        {
            var section = _sectionsRepository.Delete(sectionId);

            if (section == null)
            {
                throw new NotFoundException("No se encontro la seccion");
            }
            _sectionsRepository.Save();
            return(section);
        }
        public ActionResult Delete(int id)
        {
            tb_section section = sectionRepository.GetById(id);

            if (section != null)
            {
                sectionRepository.Delete(section);
                sectionRepository.Save();
                @ViewBag.Message = "<div class=\"alert alert-success\">La section a ete supprimee avec succes </div>";
            }
            return(RedirectToAction("Index"));
        }
        override public void Delete(object id)
        {
            var sections = _sectionRepository.FindByAttractionId((int)id).ToList();

            if (sections != null)
            {
                foreach (var section in sections)
                {
                    _sectionRepository.Delete(section.SectionId);
                }
            }

            base.Delete(id);
        }
Example #7
0
 public void Delete(int id)
 {
     try
     {
         _unitOfWork.BeginTransaction();
         var entity = GetSectionEntity(id);
         _sectionRepository.Delete(entity);
         _unitOfWork.Commit();
     }
     catch (Exception ex)
     {
         _unitOfWork.Rollback();
         throw new Exception(ex.Message);
     }
 }
Example #8
0
        public IActionResult Deleteection([FromQuery] long sectionId)
        {
            var lang          = Request.Headers["language"].ToString();
            var errorMessages = new List <string>();

            try
            {
                var deletedSection = _sectionRepository.Delete(sectionId);

                return(Ok(new { deletedSectionId = deletedSection.Id }));
            }
            catch
            {
                errorMessages.Add(_translator.GetTranslation("ERROR", lang));
                return(BadRequest(new { errors = errorMessages }));
            }
        }
Example #9
0
 public void DeleteSection(SectionEntity section)
 {
     sectionRepository.Delete(section.ToDalSection());
     uow.Commit();
 }
Example #10
0
 public void DeleteSection(long id)
 {
     sectionRepository.Delete(x => x.Id == id);
 }
Example #11
0
 public void DeleteSection(SectionEntity section)
 {
     ArgumentNullCheck(section);
     sectionRepository.Delete(section.ToDalSection());
     uow.Commit();
 }