Exemplo n.º 1
0
        /// <summary>
        /// Get Member By Identity
        /// </summary>
        /// <param name="memberViewModel"></param>
        /// <returns></returns>
        public MemberViewModel GetMember(MemberViewModel memberViewModel)
        {
            var member     = _memberRepository.FindBy(memberViewModel.MemberId);
            var memberView = member.ConvertToMemberViewModel();

            return(memberView);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Remove Member Method !
        /// </summary>
        /// <param name="membersViewModel"></param>
        public void RemoveMember(MemberViewModel membersViewModel)
        {
            var member = membersViewModel.ConvertToMemberModel();

            _memberRepository.Delete(member);
            _memberRepository.SaveChanges();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Create Blog Nees Letter Memeber method
        /// </summary>
        /// <param name="membersViewModel"></param>
        /// <returns></returns>
        public Member CreateMember(MemberViewModel membersViewModel)
        {
            var member = membersViewModel.ConvertToMemberModel();

            _memberRepository.Add(member);
            _memberRepository.SaveChanges();
            return(member);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Convert MemberViewModel To Member Extrenstion Menthod
 /// </summary>
 /// <param name="membersViewModel"></param>
 /// <returns></returns>
 public static Member ConvertToMemberModel(this MemberViewModel membersViewModel)
 {
     Mapper.CreateMap <Member, MemberViewModel>()
     .ForMember(mem => mem.MemberId, me => me.MapFrom(m => m.Id));
     return(Mapper.Map <MemberViewModel, Member>(membersViewModel));
 }