public async Task <IActionResult> Index() { SectionIndexViewModel model = new SectionIndexViewModel() { Sections = await _repository.GetSectionsAsync() }; ViewBag.Title = _stringLocalizer["Sections"].ToString(); return(View(model)); }
public async Task <IActionResult> CreateScript(SectionIndexViewModel model) { model.CreatedScript.GroupId = model.Group.Id; model.CreatedScript.SectionId = model.CurrentSection.Id; model.CreatedScript.Creator = await _userManager.GetUserAsync(User); model.CreatedScript.DateCreated = DateTime.Now; DoctrinaScript newScript = _doctrinaGroupRepository.CreateScript(model.CreatedScript); return(Redirect($"/groups/{model.Group.Id}/{model.CurrentSection.Id}/{newScript.Id}")); }
public IActionResult UpdateSettings(SectionIndexViewModel model) { if (ModelState.IsValid) { if (!string.IsNullOrEmpty(model.SectionSettings.NewName)) { _doctrinaGroupRepository.UpdateSection(model.CurrentSection.Id, model.SectionSettings); } } return(Redirect($"/groups/{model.Group.Id}/{model.CurrentSection.Id}")); }
public IActionResult Index(string groupId, int sectionId) { DoctrinaGroup currentGroup = _doctrinaGroupRepository.GetGroup(groupId); DoctrinaGroupSection currentSection = _doctrinaGroupRepository.GetSection(sectionId); IList <DoctrinaScript> scripts = _doctrinaGroupRepository.GetScripts(sectionId); SectionIndexViewModel model = new SectionIndexViewModel { Group = currentGroup, CurrentSection = currentSection, Scripts = scripts }; return(View(model)); }
public async Task <ActionResult> SearchResult(SectionIndexViewModel data) { if (data.queries == null) { return(View("Index", data)); } else { var postTask = await client.PostAsJsonAsync("/api/Section/Search", data); var UserResult = await postTask.Content.ReadAsAsync <SectionSearchViewModel>(); return(Json(UserResult, JsonRequestBehavior.AllowGet)); } }
public IActionResult DeleteSection(SectionIndexViewModel model) { _doctrinaGroupRepository.DeleteSection(model.CurrentSection.Id); return(Redirect($"/groups/{model.Group.Id}")); }
// GET: Section public ActionResult Index() { SectionIndexViewModel model = new SectionIndexViewModel(); return(View("Index", model)); }