Esempio n. 1
0
        // GET: PhoneCall
        // Phone call action method
        public ActionResult CallMember(int?id, string number)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var    member         = unitOfWork.MemberRepository.FindMemberById(id);
            string memberFullName = $"{member.FirstName} {member.LastName}";

            var phoneCallContact = new PhoneCallContact
            {
                MemberId            = (int)id,
                MemberFullName      = memberFullName,
                CallDateTime        = DateTime.Now,
                PhoneNumber         = number,
                HrefPhoneNumberLink = PhoneCallService.GetHrefPhoneNumberLink(number)
            };

            var contactTypes = unitOfWork.ContactTypeRepository.FindAll(ct => ct.Name.Contains("Call"));

            phoneCallContact.ContactTypes = new SelectList(contactTypes, "Id", "Name");

            return(View(phoneCallContact));
        }
        // GET: CcgMembers/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var ccgMember = unitOfWork.MemberRepository.FindMemberById(id);

            if (ccgMember == null)
            {
                return(HttpNotFound());
            }

            var memberDetailsVM = Mapper.Map <DetailsMemberViewModel>(ccgMember);

            _service.SetImgSrcAndHasPhotoFlag(memberDetailsVM);

            var ccg = unitOfWork.CCGRepository.FindById(memberDetailsVM.CCG.Id);

            //concat ccg name with deacon last names
            memberDetailsVM.CCG.CCGName = _ccgService.SetCCGViewName(ccg);


            // If user is not the member's deacon, use href links for phone numbers
            // Users who are not the member's deacon cannot make calls through the app
            memberDetailsVM.IsUserMemberDeacon = AuthHelper.IsMemberDeacon(User.Identity.Name, ccgMember.Id);
            if (!memberDetailsVM.IsUserMemberDeacon)
            {
                memberDetailsVM.HrefPhoneNumberLink
                    = PhoneCallService.GetHrefPhoneNumberLink(ccgMember.PhoneNumber);
                memberDetailsVM.HrefCellNumberLink
                    = PhoneCallService.GetHrefPhoneNumberLink(ccgMember.CellPhoneNumber);
            }
            return(View(memberDetailsVM));
        }