Search
public interface ISimpleStorage { List<string> Messages { get; } void AddMessage(string message); }
public class MessageModel { [Required] [DataType(DataType.Text)] [Display(Name = "Your Message")] public string Message { get; set; } } public class MessagesModel { [DataType(DataType.Text)] public List<string> Messages { get; set; } }
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcApplication2.Models.MessageModel>" %> <asp:Content ID="aboutTitle" ContentPlaceHolderID="TitleContent" runat="server"> About - My ASP.NET MVC Application </asp:Content> <asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server"> <hgroup class="title"> <h1>You can insert your messages here</h1> </hgroup> <% using (Html.BeginForm()) {%> <div> <fieldset> <div class="editor-label"> <%: Html.LabelFor(m =>m.Message) %> </div> <div class="editor-field"> <%: Html.TextAreaFor(m =>m.Message) %> <%: Html.ValidationMessageFor(m =>m.Message) %> </div> <p> <input type="submit" value="Uloz vzkaz"/> </p> </fieldset> </div> <% } %> <aside> <h3>Aside Title</h3> <p> Use this area to provide additional information. </p> <ul> <li><%: Html.ActionLink("Home", "Index", "Home") %></li> <li><%: Html.ActionLink("About", "About", "Home") %></li> <li><%: Html.ActionLink("Contact", "Contact", "Home") %></li> </ul> </aside> </asp:Content>