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); }
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); }
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); } }
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); } }