Exemplo n.º 1
0
        public static List <Member> GetMembers()
        {
            var result = new List <Member>();

            using (var db = new CBHSDBContext())
            {
                var query = from m in db.Members
                            orderby m.MemberId
                            select m;
                result = query.ToList <Member>();
            }

            return(result);
        }
Exemplo n.º 2
0
        public List <Entity.Member> GetMembers()
        {
            var result = new List <Entity.Member>();

            using (var db = new CBHSDBContext())
            {
                var query = from m in db.Members
                            orderby m.MemberId descending
                            select m;

                result = _mapper.Map <List <Datasource.Member>, List <Entity.Member> >(query.ToList <Member>());
            }

            return(result);
        }
Exemplo n.º 3
0
        public bool AddMember(Entity.Member member)
        {
            try
            {
                using (var db = new CBHSDBContext())
                {
                    db.Members.Add(_mapper.Map <Entity.Member, Datasource.Member>(member));
                    db.SaveChanges();
                }

                return(true);
            }
            catch (Exception ex)
            {
                //Log the exception
                return(false);
            }
        }
Exemplo n.º 4
0
        public static bool AddMember(Member member)
        {
            //member.MemberId = members.Count() + 1;
            try
            {
                //members.Add(member);
                using (var db = new CBHSDBContext())
                {
                    db.Members.Add(member);
                    db.SaveChanges();
                }

                return(true);
            }
            catch (Exception ex)
            {
                //Log the exception
                return(false);
            }
        }