public IActionResult Create() { var model = new RedirectPathCreateModel() { }; return(this.View(model)); }
public IActionResult Create(RedirectPathCreateModel model) { if (!this.ModelState.IsValid) { return(this.View(model)); } var dbModel = this.redirectPathRepository.Get(model.Path); if (dbModel != null) { throw new System.Exception("already exists"); } this.redirectPathRepository.Create(new Data.Models.Db.RedirectPath() { Path = model.Path.Trim(), PathDestination = model.PathDestination.Trim() }); return(this.RedirectToAction(nameof(this.Index))); }