コード例 #1
0
ファイル: offerService.cs プロジェクト: devindran/iflix
        public IEnumerable <ActionModel> LoadActions(string path, string partner)
        {
            var          json    = _fileProvider.Value.read(path);
            ActionsModel actions = null;

            try
            {
                actions = JsonConvert.DeserializeObject <ActionsModel>(json);
            }
            catch (Exception)
            {
                // log exception
                Console.WriteLine($"Failed to deserialize JSON for {partner}");
            }

            var list = new List <ActionModel>();

            if (actions?.revocations?.Any() == true)
            {
                list.AddRange(actions.revocations.Select(c => {
                    c.action  = "revocation";
                    c.partner = partner;
                    return(c);
                }));
            }
            if (actions?.grants?.Any() == true)
            {
                list.AddRange(actions.grants.Select(c => {
                    c.action  = "grant";
                    c.partner = partner;
                    return(c);
                }));
            }
            return(list);
        }
コード例 #2
0
ファイル: ActionsController.cs プロジェクト: hieuhan/hCMS
        // GET: Actions
        public ActionResult Index()
        {
            var model = new ActionsModel
            {
                ListActions      = new Actions().GetAllHierachy2($"\xA0\xA0\xA0"),
                ListActionStatus = ActionStatus.Static_GetList()
            };

            return(View(model));
        }
コード例 #3
0
ファイル: AdminLogHandler.cs プロジェクト: boydsmit/MeadowBot
        public async Task AddLogAsync(string dbName, long id, string username, string type, string reason)
        {
            var mongoDbHandler = new MongoDBHandler(dbName);
            var actionModel    = new ActionsModel(type, reason);
            var currentEntry   = mongoDbHandler.LoadRecordByField <UserLogsModel>("Logs", "_id", id);
            var actions        = new List <ActionsModel>();

            if (currentEntry != null)
            {
                actions = currentEntry.Actions;
            }

            actions.Add(actionModel);

            var userLogsModel = new UserLogsModel(id, username, actions);

            await mongoDbHandler.Upsert("Logs", userLogsModel.UserId, userLogsModel);
        }
コード例 #4
0
ファイル: ActionsController.cs プロジェクト: hieuhan/hCMS
 public ActionResult MultipleAction(ActionsModel model)
 {
     if (model.ActionsId != null && model.ActionsId.Length > 0)
     {
         short systemMessageId = 0;
         foreach (var actionId in model.ActionsId)
         {
             var action = new Actions
             {
                 ActionId = actionId
             };
             if (model.Delete != null)
             {
                 action.Delete(0, 0, ref systemMessageId);
             }
         }
     }
     return(Redirect("/Actions/Index"));
 }
コード例 #5
0
ファイル: ActionsViewModel.cs プロジェクト: philhd/swappy
 public ActionsViewModel()
 {
     this.actionsModel = new ActionsModel();
 }