コード例 #1
0
        public async Task<ActionResult<ScriptElementModel>> GetScriptElement(long id)
        {
            var result = Check(DB.Scripts, Operation.Read);
            if (result.Fail()) return result;

            var entity = await DB_TABLE
                .Join(AllowedIds(Operation.Read), o => o.Script.Campaign_Id, i => i, (o, i) => o)
                .FirstOrDefaultAsync(e => e.Id == id);

            result = Check(entity != null, NotFound).OkNull() ?? CheckETag(entity.GetHash());
            if (result.Fail()) return result;

            return GetModel(entity);
        }
コード例 #2
0
        public async Task <ActionResult <LeadPropertyModel> > GetLeadProperty(long id)
        {
            var result = Check(DB.Campaigns, Operation.Read);

            if (result.Fail())
            {
                return(result);
            }

            var entity = await DB_TABLE
                         .Join(AllowedIds(Operation.Read), o => o.Campaign_Id, i => i, (o, i) => o)
                         .FirstOrDefaultAsync(e => e.Id == id);

            result = Check(entity != null, NotFound).OkNull() ?? CheckETag(entity.GetHash());
            if (result.Fail())
            {
                return(result);
            }

            return(GetModel(entity));
        }