Exemplo n.º 1
0
        public void CreateThirdBadge(IBadgeCollector thirdCollect, List <_Badge> _badge, Guid user_id)
        {
            PostgreConnectRepo connect     = new PostgreConnectRepo();
            string             name        = thirdCollect.Collect()[0];
            string             description = thirdCollect.Collect()[1];
            _Badge             bdg         = new _Badge(Guid.NewGuid(), name, description, user_id, DateTime.Now);

            connect.BadgeRepo.Create(bdg);
            connect.Commit();
            _badge.Add(bdg);
        }
Exemplo n.º 2
0
        public void AddBadge(_Badge bdg)
        {
            if (bdg == null)
            {
                throw new Exception("Must input the badge!");
            }

            if (_badge.Count == 3)
            {
                throw new Exception("Already have three badges");
            }

            _badge.Add(bdg);
        }
Exemplo n.º 3
0
        public void CreateFirstBadge(IBadgeCollector firstCollect, List <_Badge> _badge, Guid user_id)
        {
            PostgreConnectRepo connect     = new PostgreConnectRepo();
            string             name        = firstCollect.Collect()[0];
            string             description = firstCollect.Collect()[1];
            _Badge             bdg         = new _Badge(Guid.NewGuid(), name, description, user_id, DateTime.Now);

            if (connect.UserRepo.FindById(user_id) != null)
            {
                connect.BadgeRepo.Create(bdg);
                connect.Commit();
            }
            _badge.Add(bdg);
        }