public ActionResult EditParameter(ParameterEditDisplayModel model) { if (model is null) { throw new System.ArgumentNullException(nameof(model)); } if (model.ParameterInfo is null) { throw new NullReferenceException("ParameterInfo can not be null"); } using (this.ReportingParameterRepository.WriteContext()) { model.SQLParameterInfo = this.ReportingDatabase.GetParameters(model.ParameterInfo.ProcedureName).First(p => p.PARAMETER_NAME == model.ParameterInfo.ParameterName); ParameterInfo existing = this.ReportingParameterRepository.GetByProcedureAndName(model.ParameterInfo.ProcedureName, model.ParameterInfo.ParameterName); if (existing is null) { existing = model.ParameterInfo; } else { existing.MinValue = model.ParameterInfo.MinValue; existing.MaxValue = model.ParameterInfo.MaxValue; existing.Default = model.ParameterInfo.Default; } this.ReportingParameterRepository.AddOrUpdate(existing); } return(this.View(model)); }
public ActionResult EditParameter(string Name, string Parameter) { ParameterEditDisplayModel model = new ParameterEditDisplayModel() { ParameterInfo = this.ReportingParameterRepository.GetByProcedureAndName(Name, Parameter) ?? new ParameterInfo() { ParameterName = Parameter, ProcedureName = Name }, SQLParameterInfo = this.ReportingDatabase.GetParameters(Name).First(p => p.PARAMETER_NAME == Parameter) }; return(this.View(model)); }