This commit is contained in:
2020-01-27 19:39:00 +00:00
parent 3b2189de01
commit aac23818fb
17 changed files with 151 additions and 151 deletions

View File

@@ -1,12 +1,6 @@
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.JsonPatch;
using EnumsNET;
using AyaNova.Util;
using AyaNova.Api.ControllerHelpers;
using AyaNova.Biz;
using AyaNova.Models;
@@ -20,14 +14,14 @@ namespace AyaNova.Biz
{
//THIS IS THE METHOD CALLED BY THE ATTACHMENT CONTROLLER
internal static async Task<bool> Exists(AyaTypeId tid)
internal static async Task<bool> ExistsAsync(AyaTypeId tid)
{
return await Exists(tid.ObjectType, tid.ObjectId);
return await ExistsAsync(tid.ObjectType, tid.ObjectId);
}
//Returns existance status of object type and id specified in database
internal static bool Exists(AyaType aytype, long id, AyContext ct = null)
internal static async Task<bool> ExistsAsync(AyaType aytype, long id, AyContext ct = null)
{
//new up a context??
if (ct == null)
@@ -37,22 +31,20 @@ namespace AyaNova.Biz
switch (aytype)
{
case AyaType.User:
return ct.User.Any(m => m.Id == id);
return await ct.User.AnyAsync(m => m.Id == id);
case AyaType.Widget:
return ct.Widget.Any(m => m.Id == id);
return await ct.Widget.AnyAsync(m => m.Id == id);
case AyaType.FileAttachment:
return ct.FileAttachment.Any(m => m.Id == id);
return await ct.FileAttachment.AnyAsync(m => m.Id == id);
case AyaType.DataListFilter:
return ct.DataListFilter.Any(m => m.Id == id);
return await ct.DataListFilter.AnyAsync(m => m.Id == id);
case AyaType.DataListTemplate:
return ct.DataListTemplate.Any(m => m.Id == id);
return await ct.DataListTemplate.AnyAsync(m => m.Id == id);
case AyaType.FormCustom:
return ct.FormCustom.Any(m => m.Id == id);
return await ct.FormCustom.AnyAsync(m => m.Id == id);
default:
throw new System.NotSupportedException($"AyaNova.Biz.BizObjectExistsInDatabase::Exists type {aytype.ToString()} is not supported");
throw new System.NotSupportedException($"AyaNova.Biz.BizObjectExistsInDatabase::ExistsAsync type {aytype.ToString()} is not supported");
}
}