示例#1
0
        //
        // GET: /Gang/
        public ActionResult Index()
        {
            var identity = HardIdentify();
            if (identity != null)
            {
                var model = new GangModel { Id = identity.Id, Identified = true, Gang = identity.Gang };
                return View("Index", model);
            }

            return ErrorView("this page is only available if you are logged in.");
        }
示例#2
0
        private ActionResult StandardGangPage(string viewName)
        {
            var identity = HardIdentify();
            if (identity != null)
            {
                var model = new GangModel { Id = identity.Id, Identified = true, Gang = identity.Gang };
                return View(viewName, model);
            }

            return ErrorView("this page is only available if you are logged in.");
        }
示例#3
0
        //
        // GET: /Mail/
        public ActionResult Index()
        {
            var identity = GetIdentity();
            if (identity != null && identity.Registered)
            {
                var model = new GangModel(identity);
                return View("MailIndex", model);
            }

            return RedirectToAction("Index", "Home");
        }
示例#4
0
        public ActionResult CreateGangPost(GangModel model)
        {
            model.Valid = ModelState.IsValid;
            if (model.Valid)
            {
                using (var transaction = NhSession.BeginTransaction())
                {
                    var identity = NhSession.Get<Identity>(model.Id);

                    var gang = model.Gang;
                    gang.Funds = 1000;
                    identity.Gang = gang;

                    NhSession.Save(identity);
                    transaction.Commit();
                }

            }
            return PartialView("GangPartial", model);
        }
示例#5
0
        public ActionResult CreateGangPost(GangModel model)
        {
            model.Valid = ModelState.IsValid;
            if (model.Valid)
            {
                var hideout = CreateHideout();
                var factory = MvcApplication.SessionFactory;
                NhSession = factory.OpenSession();
                using (var transaction = NhSession.BeginTransaction())
                {
                    var identity = NhSession.Get<Identity>(model.Id);

                    var gang = model.Gang;
                    identity.Gang = gang;
                    identity.Gang.Funds = 1000;
                    identity.Gang.Hideout = hideout;
                    NhSession.Save(identity);
                    transaction.Commit();
                }

            }
            return PartialView("GangPartial", model);
        }