Refactored repository pattern for Add and Update methods so that they return their respective entity objects

This commit is contained in:
Shaun Walker
2019-08-05 09:31:04 -04:00
parent b9c007998e
commit 4fda7b17d0
43 changed files with 353 additions and 137 deletions

View File

@ -31,18 +31,24 @@ namespace Oqtane.Server.Modules.HtmlText.Controllers
// POST api/<controller>
[HttpPost]
public void Post([FromBody] HtmlTextInfo HtmlText)
public HtmlTextInfo Post([FromBody] HtmlTextInfo HtmlText)
{
if (ModelState.IsValid)
htmltext.AddHtmlText(HtmlText);
{
HtmlText = htmltext.AddHtmlText(HtmlText);
}
return HtmlText;
}
// PUT api/<controller>/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] HtmlTextInfo HtmlText)
public HtmlTextInfo Put(int id, [FromBody] HtmlTextInfo HtmlText)
{
if (ModelState.IsValid)
htmltext.UpdateHtmlText(HtmlText);
{
HtmlText = htmltext.UpdateHtmlText(HtmlText);
}
return HtmlText;
}
// DELETE api/<controller>/5