/// <inheritdoc /> public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { var value = bindingContext.ValueProvider.GetValue(bindingContext.ModelName); try { Schwierigkeit s = Schwierigkeit.Parse(value.AttemptedValue); return(s); } catch (Exception) { bindingContext.ModelState.AddModelError(bindingContext.ModelName, "invalid Schwierigkeit"); return(null); } }
public static MvcHtmlString MySchwierigkeitsgradDropDown <TModel>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, Schwierigkeit> > expression ) { var value = expression.Compile().Invoke(htmlHelper.ViewData.Model); IEnumerable <SelectListItem> seletList = Schwierigkeit.GetAllSchwierigkeiten() .Select(s => new SelectListItem { Text = s.ToString(), Value = s.ToString(), Selected = value == s }); var r = htmlHelper.DropDownListFor(expression, seletList); return(r); }
public Entry(int Id, String Name, String Beschreibung, Klassifikation Klassifikation, int Portion, Schwierigkeit Schwierigkeit, Saison Saison, Gang Gang) { this.Id = Id; this.Name = Name; this.Beschreibung = Beschreibung; this.Klassifikation = Klassifikation; this.Portionen = Portionen; this.Schwierigkeit = Schwierigkeit; this.Saison = Saison; this.Gang = Gang; }
/// <inheritdoc /> public EditingSchwierigkeitModel(Schwierigkeit current, string updateTargetId) { Current = current; UpdateTargetId = updateTargetId; }