Skip to content

Commit

Permalink
Closes #1901 News: Made CreatedOn configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-Herzog committed Jul 28, 2020
1 parent 40a0eba commit 30433b5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public ActionResult Create()
//default values
model.Published = true;
model.AllowComments = true;
model.CreatedOn = DateTime.UtcNow;
return View(model);
}

Expand All @@ -153,7 +154,7 @@ public ActionResult Create(NewsItemModel model, bool continueEditing, FormCollec

newsItem.StartDateUtc = model.StartDate;
newsItem.EndDateUtc = model.EndDate;
newsItem.CreatedOnUtc = DateTime.UtcNow;
newsItem.CreatedOnUtc = model.CreatedOn;
_newsService.InsertNews(newsItem);

// Search engine name.
Expand Down Expand Up @@ -188,6 +189,7 @@ public ActionResult Edit(int id)
var model = newsItem.ToModel();
model.StartDate = newsItem.StartDateUtc;
model.EndDate = newsItem.EndDateUtc;
model.CreatedOn = newsItem.CreatedOnUtc;

//stores
PrepareStoresMappingModel(model, newsItem, false);
Expand All @@ -209,6 +211,7 @@ public ActionResult Edit(NewsItemModel model, bool continueEditing, FormCollecti

newsItem.StartDateUtc = model.StartDate;
newsItem.EndDateUtc = model.EndDate;
newsItem.CreatedOnUtc = model.CreatedOn;
_newsService.UpdateNews(newsItem);

// Search engine name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@
@Html.ValidationMessageFor(model => model.SelectedStoreIds)
</td>
</tr>
<tr>
<td class="adminTitle">
@Html.SmartLabelFor(model => model.CreatedOn)
</td>
<td class="adminData">
@Html.EditorFor(model => model.CreatedOn)
@Html.ValidationMessageFor(model => model.CreatedOn)
</td>
</tr>
<tr>
<td class="adminTitle">
@Html.SmartLabelFor(model => model.StartDate)
Expand Down

0 comments on commit 30433b5

Please sign in to comment.