{
if (ModelState.IsValid)
{
+ projectTask.created_at = DateTime.Now;
+ projectTask.updated_at = DateTime.Now;
db.ProjectTasks.Add(projectTask);
db.SaveChanges();
return RedirectToAction("Index");
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
- public ActionResult Edit([Bind(Include = "id,project_id,name,description,created_at,updated_at,task_status_id,user_id")] ProjectTask projectTask)
+ public ActionResult Edit([Bind(Include = "id,project_id,name,description,task_status_id,user_id,created_at")] ProjectTask projectTask)
{
if (ModelState.IsValid)
{
+ projectTask.updated_at = DateTime.Now;
db.Entry(projectTask).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
- public ActionResult Create([Bind(Include = "id,user_id,name,description,created_at,updated_at")] Project project)
+ public ActionResult Create([Bind(Include = "id,user_id,name,description")] Project project)
{
if (ModelState.IsValid)
{
+ project.created_at = DateTime.Now;
+ project.updated_at = DateTime.Now;
db.Projects.Add(project);
db.SaveChanges();
return RedirectToAction("Index");
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
- public ActionResult Edit([Bind(Include = "id,user_id,name,description,created_at,updated_at")] Project project)
+ public ActionResult Edit([Bind(Include = "id,user_id,name,description,created_at")] Project project)
{
if (ModelState.IsValid)
{
+ project.updated_at = DateTime.Now;
db.Entry(project).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
</div>
</div>
- <div class="form-group">
- @Html.LabelFor(model => model.created_at, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => model.created_at, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => model.created_at, "", new { @class = "text-danger" })
- </div>
- </div>
-
- <div class="form-group">
- @Html.LabelFor(model => model.updated_at, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => model.updated_at, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => model.updated_at, "", new { @class = "text-danger" })
- </div>
- </div>
-
<div class="form-group">
@Html.LabelFor(model => model.task_status_id, "task_status_id", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.HiddenFor(model => model.id)
+ <div class="form-group">
+ <label class="control-label col-sm-2" for="createdAt">Wpis utworzony:</label>
+ <div class="col-sm-10">
+ <p class="form-control-static">@Html.DisplayFor(model => model.created_at)</p>
+ @Html.EditorFor(model => model.created_at, new { htmlAttributes = new { @class = "form-control", @type = "hidden" } })
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="control-label col-sm-2" for="updatedAt">Ostatnio modyfikowany:</label>
+ <div class="col-sm-10">
+ <input type="text" class="form-control" id="updatedAt" placeholder="@Html.DisplayFor(model => model.updated_at)" readonly>
+ </div>
+ </div>
<div class="form-group">
@Html.LabelFor(model => model.project_id, "project_id", htmlAttributes: new { @class = "control-label col-md-2" })
</div>
</div>
- <div class="form-group">
- @Html.LabelFor(model => model.created_at, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => model.created_at, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => model.created_at, "", new { @class = "text-danger" })
- </div>
- </div>
-
- <div class="form-group">
- @Html.LabelFor(model => model.updated_at, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => model.updated_at, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => model.updated_at, "", new { @class = "text-danger" })
- </div>
- </div>
-
<div class="form-group">
@Html.LabelFor(model => model.task_status_id, "task_status_id", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
</div>
</div>
- <div class="form-group">
- @Html.LabelFor(model => model.created_at, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => model.created_at, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => model.created_at, "", new { @class = "text-danger" })
- </div>
- </div>
-
- <div class="form-group">
- @Html.LabelFor(model => model.updated_at, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => model.updated_at, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => model.updated_at, "", new { @class = "text-danger" })
- </div>
- </div>
-
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Stwórz" class="btn btn-default" />
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.HiddenFor(model => model.id)
+ <div class="form-group">
+ <label class="control-label col-sm-2" for="createdAt">Wpis utworzony:</label>
+ <div class="col-sm-10">
+ <p class="form-control-static">@Html.DisplayFor(model => model.created_at)</p>
+ @Html.EditorFor(model => model.created_at, new { htmlAttributes = new { @class = "form-control", @type = "hidden" } })
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="control-label col-sm-2" for="updatedAt">Ostatnio modyfikowany:</label>
+ <div class="col-sm-10">
+ <input type="text" class="form-control" id="updatedAt" placeholder="@Html.DisplayFor(model => model.updated_at)" readonly>
+ </div>
+ </div>
<div class="form-group">
@Html.LabelFor(model => model.user_id, "user_id", htmlAttributes: new { @class = "control-label col-md-2" })
</div>
</div>
- <div class="form-group">
- @Html.LabelFor(model => model.created_at, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => model.created_at, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => model.created_at, "", new { @class = "text-danger" })
- </div>
- </div>
-
- <div class="form-group">
- @Html.LabelFor(model => model.updated_at, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => model.updated_at, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => model.updated_at, "", new { @class = "text-danger" })
- </div>
- </div>
-
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Zapisz" class="btn btn-default" />