public IActionResult Create() { var categories = this.categoriesService.GetAll <CategoryDropDownViewModel>(); var viewModel = new HashtagSetCreateInputModel { Categories = categories, }; return(this.View(viewModel)); }
public async Task <IActionResult> Edit(HashtagSetCreateInputModel viewModel) { if (this.ModelState.IsValid) { await this.hashtagSetsService.EditAsync(viewModel.Text, viewModel.CategoryId, viewModel.IsPrivate, viewModel.Id); return(this.RedirectToAction(nameof(this.ById), new { id = viewModel.Id })); } viewModel.Categories = this.categoriesService.GetAll <CategoryDropDownViewModel>(); return(this.View(viewModel)); }
public async Task <IActionResult> Create(HashtagSetCreateInputModel inputModel) { if (!this.ModelState.IsValid) { return(this.View(inputModel)); } var user = await this.userManager.GetUserAsync(this.User); await this.hashtagSetsService.CreateAsync(inputModel.Text, user.Id, inputModel.CategoryId, inputModel.IsPrivate); return(this.RedirectToAction("MySets")); }