This commit is contained in:
2020-03-17 19:38:40 +00:00
parent f10ae6829e
commit edc3d58231
2 changed files with 6 additions and 0 deletions

View File

@@ -154,6 +154,7 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// POST (replace) Pick List template
/// (note: in this case the Id is the AyaType numerical value as there is only one template per type)
/// </summary>
/// <param name="template"></param>
/// <returns></returns>

View File

@@ -155,9 +155,11 @@ namespace AyaNova.Biz
internal async Task<bool> ReplaceAsync(PickListTemplate template)
{
var o = await ct.PickListTemplate.FirstOrDefaultAsync(m => m.Id == (long)template.Id);
bool bAdd = false;
if (o == null)
{
o = new PickListTemplate();
bAdd = true;
}
o.Id = (long)template.Id;
o.Template = template.Template;
@@ -166,6 +168,9 @@ namespace AyaNova.Biz
Validate(o);
if (HasErrors)
return false;
if (bAdd)
await ct.PickListTemplate.AddAsync(o);
await ct.SaveChangesAsync();
//Log modification and save context