or
@using ( Html.BeginForm("Admin", "Account") )
{
@Html.ValidationSummary(true)
<
fieldset
>
<
legend
><
b
>Създаване на нова новина</
b
></
legend
>
<
h1
>Title</
h1
>
@*Render the editor for the title*@
@(Html.Kendo().EditorFor(m => m.title).Name("Title").Value("Заглавието на новината"))
<
h1
>NewsText</
h1
>
@*Render the editor for the text*@
@(Html.Kendo().EditorFor(m => m.text).Name("Text").Value("Текста на новината"))
<
input
type
=
"button"
value
=
"Submit"
/>
</
fieldset
>
}
[Authorize]
[HttpGet]
public
ActionResult Admin()
{
return
View();
}
[HttpPost]
public
ActionResult Admin(
string
Title,
string
Text)
{
NewsDal.setNews(Title, Text);
return
Redirect(
"/Home/News"
);
}
public
static
void
setNews(
string
Title,
string
Text)
{
InfoEntities db =
new
InfoEntities();
db.AddToNews(
new
News()
{
title = Title,
text = Text,
});
db.SaveChanges();
}
<
input
class
=
"k-textbox input-validation-error"
id
=
"textBox"
name
=
"textBox"
type
=
"text"
value
=
""
>
.input-validation-error
{
border: 1px solid #ff0000;
background-color: #ffeeee;
}
input[type="text"]
{
width: 200px;
border: 1px solid #CCC;
}