Ejemplo n.º 1
0
        public static ActionModel NewActionModel(ApplicationDbContext db, string identityName)
        {
            var model = new ActionModel();

            model.User = db.Users.FirstOrDefault(u => u.UserName == identityName);
            model.Corporation = db.Corporations.FirstOrDefault(c => c.User.Id == model.User.Id);
            model.Test = "TESTINGYAY";

            model.DataCache = new DataCache(db, model.User, model.Corporation);

            return model;
        }
Ejemplo n.º 2
0
        // GET: Action
        public IActionResult Index(ActionModel actionModel)
        {
            var model = ActionModel.NewActionModel(db, User.Identity.Name);

            var data = new DataCache(db, model.User, model.Corporation);
            data.RefreshCache();
            model.DataCache = data;

            if (model.Corporation.TurnCount > 1)
            {
                model.Messages = LogService.GetLogsByTurn(db, model.Corporation, model.Corporation.TurnCount - 1);
            }

            data.RefreshCache();
            model.BuildViewItems(db);

            return View(model);
        }