Beispiel #1
0
        public ActionResult Edit(MemberResponseModel model)
        {
            var updatemodel = new UpdateMemberRequestModel()
                {
                    ApiKey = null,
                    MemberAbout = model.Member.MemberAbout,
                    MemberAddress = model.Member.MemberAddress,
                    MemberAllowViewAbout = model.Member.MemberAllowViewAbout,
                    MemberAllowViewAddress = model.Member.MemberAllowViewAddress,
                    MemberAllowViewBithday = model.Member.MemberAllowViewBithday,
                    MemberAllowViewEmail = model.Member.MemberAllowViewEmail,
                    MemberAllowViewFavorite = model.Member.MemberAllowViewFavorite,
                    MemberBirthday = model.Member.MemberBirthday,
                    MemberCountry = model.Member.MemberCountry,
                    MemberEmail = model.Member.MemberEmail,
                    MemberFacebookId = model.Member.MemberFacebookId,
                    MemberFavorite = model.Member.MemberFavorite,
                    MemberFirstName = model.Member.MemberFirstName,
                    MemberGender = model.Member.MemberGender,
                    MemberId = model.Member.MemberId,
                    MemberLastName = model.Member.MemberLastName,
                    MemberUserName = model.Member.MemberUserName,
                    MemberAllowViewCompany = model.Member.MemberAllowViewCompany,
                    MemberAllowViewFacebookId = model.Member.MemberAllowViewFacebookId,
                    MemberAllowViewSkype = model.Member.MemberAllowViewSkype,
                    MemberCompany = model.Member.MemberCompany,
                    MemberAllowViewPhoneNumber = model.Member.MemberAllowViewPhoneNumber,
                    MemberSkype = model.Member.MemberSkype,
                    MemberPhoneNumber = model.Member.MemberPhoneNumber
                };

            var result = MemberRepository.UpdateMember(updatemodel);

            if (result.Code == "1")
            {
                ViewData["Success"] = true;
                return View(model);
            }

            ModelState.AddModelError("",result.Message);
            return View(model);
        }
Beispiel #2
0
        public ActionResult UpdateInfo()
        {
            var model = new MemberResponseModel();

                if (SessionManager.IsLoggedIn)
                    model = MemberRepository.GetSingle(SessionManager.UserLogged.UserId, null);
                else
                    model.Code = "-1";

            if (model.Code == "1")
            {
                AutoMapper.Mapper.CreateMap<MemberModel, MemberInfoViewModel>();
                var modelMem = AutoMapper.Mapper.Map<MemberInfoViewModel>(model.Member);
                modelMem.IsFriend = true;
                modelMem.IsUserLogin = SessionManager.IsLoggedIn && (SessionManager.UserLogged.UserId == model.Member.MemberId);
                return View(modelMem);
            }
            return RedirectToAction("Index", "Home");
        }
Beispiel #3
0
        public ActionResult InfoUser(string id)
        {
            var model = new MemberResponseModel();
            if (string.IsNullOrEmpty(id))
            {
                if (SessionManager.IsLoggedIn)
                    model = MemberRepository.GetSingle(SessionManager.UserLogged.UserId, null);
                else
                    model.Code = "-1";
            }
            else
            {
                var isId = BSG.BG.Contrib.CommonLib.IsGuid(id);
                model = isId ? MemberRepository.GetSingle(id, null) : MemberRepository.GetSingleByUserNameOrEmail(null, id, null);
            }

            if (model.Code == "1")
            {
                AutoMapper.Mapper.CreateMap<MemberModel, MemberInfoViewModel>();
                var modelMem = AutoMapper.Mapper.Map<MemberInfoViewModel>(model.Member);
                modelMem.IsFriend = true;
                modelMem.IsUserLogin = SessionManager.IsLoggedIn && (SessionManager.UserLogged.UserId == model.Member.MemberId);
                return View(modelMem);
            }
            return RedirectToAction("Index", "Home");
        }