コード例 #1
0
        public bool Authenticate(string username, string password)
        {
            using (IDal dal = new ProtoDBContext())
            {
                var user = dal.GetUserByName(username);

                if (user == null)
                    return false;

                if (user.Password != password)
                    return false;
            }
            return true;
        }
コード例 #2
0
        public bool? AddPet(AddPetMessage message)
        {
            using (IDal dal = new ProtoDBContext())
            {
                var user = dal.GetUserByName(Thread.CurrentPrincipal.Identity.Name);

                if (user == null)
                    return null;

                if (user.ID != message.UserId)
                    return null;
                var petmapper = new ProtoPetMap(dal);

                return dal.AddPet(petmapper.Map(message.Model) as IPet);
            }
        }