This commit is contained in:
@@ -7,9 +7,7 @@
|
|||||||
|
|
||||||
//PICKLISTS:
|
//PICKLISTS:
|
||||||
|
|
||||||
todo: User objects need Tags (as will all CORE objects for sure)
|
|
||||||
- Also make sure SEEDER seeds them with the same range of sample tags as for the Widgets
|
|
||||||
|
|
||||||
todo: all template routes and actual backing code and also validation, needs to validate templates
|
todo: all template routes and actual backing code and also validation, needs to validate templates
|
||||||
todo: clean out unneeded leftovers from AyaPickListFieldDefinition
|
todo: clean out unneeded leftovers from AyaPickListFieldDefinition
|
||||||
todo: add pickers for all CORE objects (User...?)
|
todo: add pickers for all CORE objects (User...?)
|
||||||
|
|||||||
@@ -143,28 +143,28 @@ namespace AyaNova.Biz
|
|||||||
//put
|
//put
|
||||||
internal async Task<bool> ReplaceAsync(AyaType ayaType, string template)
|
internal async Task<bool> ReplaceAsync(AyaType ayaType, string template)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
|
||||||
// //preserve the owner ID if none was specified
|
|
||||||
// if (inObj.UserId == 0)
|
|
||||||
// inObj.UserId = dbObj.UserId;
|
|
||||||
|
|
||||||
// //Replace the db object with the PUT object
|
|
||||||
// CopyObject.Copy(inObj, dbObj, "Id");
|
|
||||||
// //Set "original" value of concurrency token to input token
|
|
||||||
// //this will allow EF to check it out
|
|
||||||
// ct.Entry(dbObj).OriginalValues["ConcurrencyToken"] = inObj.ConcurrencyToken;
|
|
||||||
|
|
||||||
// await ValidateAsync(dbObj, false);
|
var o = await ct.PickListTemplate.FirstOrDefaultAsync(m => m.Id == (long)ayaType);
|
||||||
// if (HasErrors)
|
if (o == null)
|
||||||
// return false;
|
{
|
||||||
// await ct.SaveChangesAsync();
|
o = new PickListTemplate();
|
||||||
|
}
|
||||||
|
o.Id = (long)ayaType;
|
||||||
|
o.Template = template;
|
||||||
|
|
||||||
// //Log modification and save context
|
|
||||||
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
|
Validate(o);
|
||||||
|
if (HasErrors)
|
||||||
|
return false;
|
||||||
|
await ct.SaveChangesAsync();
|
||||||
|
|
||||||
|
//Log modification and save context
|
||||||
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, o.Id, BizType, AyaEvent.Modified), ct);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -206,9 +206,18 @@ namespace AyaNova.Biz
|
|||||||
//
|
//
|
||||||
|
|
||||||
//Can save or update?
|
//Can save or update?
|
||||||
private async Task ValidateAsync(DataListView inObj, bool isNew)
|
private void Validate(PickListTemplate inObj)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
//validate that the template is valid, the type is legit etc
|
||||||
|
var TemplateType = (AyaType)inObj.Id;
|
||||||
|
if (!TemplateType.HasAttribute(typeof(CoreBizObjectAttribute)))
|
||||||
|
{
|
||||||
|
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "AyaType", "AyaType specified is not a core object type and doesn't support pick list templates");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// //UserId required
|
// //UserId required
|
||||||
// if (!isNew)
|
// if (!isNew)
|
||||||
// {
|
// {
|
||||||
|
|||||||
Reference in New Issue
Block a user