Let's suppose I want to register an item in my database. Knowing my item name and price. But I want to also when registering the item should also register the date. How do I do this? I am still new to Asp.net Mvc
MODEL
public class TABLE
{
[Key]
public int IdApp { get; set; }
public string AppName { get; set; }
public DateTime Data { get; set; }
public int Size { get; set; }
public double Price { get; set; }
public byte[] FotoByte { get; set; }
[NotMapped]
[Required(ErrorMessage = "O Campo da foto está Vazio")]
public HttpPostedFileBase foto { get; set; }
}
VIEW
@model Store.Models.CadastroApp.TABLE
@{
ViewBag.Title = "RecordApp";
}
<link href="~/Content/css/RecordApp/index.css" rel="stylesheet" />
<div class="container">
<div class="container">
<div class="jumbotron">
<h2>App Register</h2><br />
<div class="">
@Html.TextBoxFor(x=>x.AppName, new {@class="form-control",@placeholder="informa o nome do App" })<br />
@Html.TextBoxFor(x=>x.Price,new { @class = "form-control",@placeholder="informa o preço"})<br />
@Html.TextBoxFor(x => x.foto, new { type = "file" })
@Html.ValidationMessageFor(x => x.foto)
</div>
</div>
</div>
</div>