public IActionResult Delete(SectionViewModel vm)
        {
            var section = _sectionService.GetSectionById(vm.Id);

            _sectionService.DeleteSection(section);
            return(RedirectToAction("List", "Section"));
        }
示例#2
0
        public ActionResult <SectionAddViewModel> DeleteSection(SectionAddViewModel section)
        {
            SectionAddViewModel sectionDelete = new SectionAddViewModel();

            try
            {
                if (section.tableSections.SchoolId > 0)
                {
                    sectionDelete = _sectionService.DeleteSection(section);
                }
                else
                {
                    sectionDelete._token      = section._token;
                    sectionDelete._tenantName = section._tenantName;
                    sectionDelete._failure    = true;
                    sectionDelete._message    = "Please enter valid scholl id";
                }
            }
            catch (Exception es)
            {
                sectionDelete._failure = true;
                sectionDelete._message = es.Message;
            }
            return(sectionDelete);
        }
示例#3
0
        public ActionResult DeleteSection(int sectionId)
        {
            var anyArticle = articleService.GetArticleEntityBySection(sectionId).Any();

            if (!anyArticle)
            {
                sectionService.DeleteSection(sectionService.GetSectionEntityById(sectionId));
            }
            return(RedirectToAction("WorkWithSections", "Section"));
        }
示例#4
0
        public async Task <IActionResult> DeleteSection(Guid id)
        {
            var section = (await _service.FindSectionsByCondition(p => p.Id == id, true)).FirstOrDefault();

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

            _service.DeleteSection(section);
            await _service.Save();

            return(NoContent());
        }
示例#5
0
        public void Can_Add_Section()
        {
            // delete it if it exists, before running installer
            Section section = _sectionService.GetByAlias("workflow");

            if (section != null)
            {
                _sectionService.DeleteSection(section);
            }

            Assert.Null(_sectionService.GetByAlias("workflow"));

            var install = new Workflow.Helpers.Installer();

            Assert.True(install.AddSection(ApplicationContext.Current));
        }
示例#6
0
        public ActionResult DeleteTypeInCourseLevel(int courseId, int levelId, int typeId)
        {
            string uid = User.Identity.GetUserId();

            if (!courseService.CanUserModifyCourseLevelsAndTypes(uid, courseId))
            {
                this.AddNotification("Ju nuk mund te fshini tipe ne kursin me id:" + courseId, NotificationType.ERROR);
                return(RedirectToAction("CourseLevelTypes", "Course", new { @courseId = courseId, @levelId = levelId }));
            }
            bool result = sectionService.DeleteSection(courseId, levelId, typeId);

            if (!result)
            {
                return(new HttpNotFoundResult());
            }
            var level = levelService.GetLevelById(levelId);
            var type  = typeService.GetTypeById(typeId);

            this.AddNotification("Tipi " + type.Tipi + " u fshi nga niveli " + level.Emri, NotificationType.SUCCESS);
            return(RedirectToAction("CourseLevelTypes", "Course", new { @courseId = courseId, @levelId = levelId }));
        }
示例#7
0
        public ActionResult Delete(int id)
        {
            int result = 0;

            if (UserRolePermissionForPage.Delete == true)
            {
                result = _iCommonService.GetValidateReference("Section", id.ToString());
                if (result > 0)
                {
                    return(RedirectToAction(nameof(Index), new { noDelete = result }));
                }
                else
                {
                    var deletedid = _iSectionService.DeleteSection(id);
                    return(RedirectToAction(nameof(Index)));
                }
            }
            else
            {
                return(RedirectToAction("NotFound", "Error"));
            }
        }
示例#8
0
 public RedirectResult SectionDelete(int sectionId)
 {
     _sectionService.DeleteSection(sectionId);
     return(Redirect("/section"));
 }
示例#9
0
 public IActionResult Delete(long id)
 {
     sectionService.DeleteSection(id);
     sectionService.SaveSection();
     return(RedirectToAction("Index", "Section"));
 }
示例#10
0
 public IActionResult DeleteSection(int id)
 {
     _sectionService.DeleteSection(id);
     return(RedirectToAction("Index"));
 }
示例#11
0
 public ActionResult DeleteSection(int id)
 {
     sectionService.DeleteSection(id);
     return(RedirectToAction("Sections", "Home"));
 }