/// <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); }
/// <summary> /// Remove Member Method ! /// </summary> /// <param name="membersViewModel"></param> public void RemoveMember(MemberViewModel membersViewModel) { var member = membersViewModel.ConvertToMemberModel(); _memberRepository.Delete(member); _memberRepository.SaveChanges(); }
/// <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); }
/// <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)); }