public ActionResult CodeValidation(CodeValidationViewModel viewModel) { if (viewModel.Property != 0) { this.ModelState.AddModelError(nameof(CodeValidationViewModel.Property), "Property has to be 0"); } if (this.ModelState.IsValid) { return(this.RedirectToAction("Index", "Validation") .WithSuccessAlert("Validation entity has been created")); } return(this.View(viewModel)); }
public ActionResult CodeValidation() { var viewModel = new CodeValidationViewModel(); return(this.View(viewModel)); }