示例#1
0
        public bool SaveTaster(Taster taster)
        {
            if (Session == null || Session.IsAvailable == false)
            {
                return(false);
            }

            Session.SetString(nameof(taster.DisplayName), taster.DisplayName);
            Session.SetString(nameof(taster.EmailAddress), taster.EmailAddress);
            Session.SetInt32(nameof(taster.IsAdmin), taster.IsAdmin ? 1 : 0);
            Session.SetInt32(nameof(taster.TasterId), taster.TasterId);

            return(true);
        }
示例#2
0
        public Taster GetTaster()
        {
            var taster = new Taster()
            {
                TasterId = -1
            };

            if (Session == null || Session.IsAvailable == false)
            {
                return(taster);
            }

            taster.DisplayName  = Session.GetString(nameof(taster.DisplayName));
            taster.EmailAddress = Session.GetString(nameof(taster.EmailAddress));
            taster.IsAdmin      = Session.GetInt32(nameof(taster.IsAdmin)) == 1 ? true : false;

            var id = Session.GetInt32(nameof(taster.TasterId));

            taster.TasterId = id.HasValue ? id.Value : -1;

            return(taster);
        }