This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user