Пример #1
0
        public ActionResult Create(ProfileModelView profile, HttpPostedFileBase profilePicture, HttpPostedFileBase profileCv)
        {
            if (profile == null)
            {
                throw new ArgumentNullException(nameof(profile));
            }

            if (!ModelState.IsValid)
            {
                var model = this.profileService.GetProfileView(profile, string.Empty);
                return(this.View("Create", model));
            }

            var message = this.profileService.SaveProfileInfo(profile, profilePicture, profileCv);

            if (!string.IsNullOrEmpty(message))
            {
                var model = this.profileService.GetProfileView(profile, message);
                return(this.View("Create", model));
            }

            message = string.Format("Profile Created, You need to complete your profile");

            return(RedirectToAction("Index", "Profile", new { message }));
        }
Пример #2
0
        public ActionResult Edit(ProfileModelView profileModelInfo, HttpPostedFileBase profilePicture,
                                 HttpPostedFileBase profileCV)
        {
            if (profileModelInfo == null)
            {
                throw new ArgumentNullException(nameof(profileModelInfo));
            }

            if (!ModelState.IsValid)
            {
                var viewModel = this.profileService.GetProfileView(profileModelInfo, string.Empty);

                return(this.PartialView("Edit", viewModel));
            }

            var processingMessage = profileService.ProcessProfileEditView(profileModelInfo, profilePicture, profileCV);

            if (!string.IsNullOrEmpty(processingMessage))
            {
                var viewModel = this.profileService.GetProfileView(profileModelInfo, processingMessage);

                return(this.PartialView("Edit", viewModel));
            }

            processingMessage = string.Format("You Successfully Edit your Profile");

            return(this.RedirectToAction("Index", "Profile", new { message = processingMessage }));
        }
Пример #3
0
        /// <summary>
        /// Edits the profile view.
        /// </summary>
        /// <param name="profileInfo">The profile information.</param>
        /// <param name="userDetail">The user detail.</param>
        /// <param name="genderCollection">The gender collection.</param>
        /// <param name="countryCollection">The country collection.</param>
        /// <param name="processingMessage">The processing message.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentException">genderCollection</exception>
        /// <exception cref="ArgumentNullException">
        /// profileInfo
        /// or
        /// userDetail
        /// </exception>
        public IProfileView EditProfileView(IProfile profileInfo, IUserDetail userDetail, IList <IYourGender> genderCollection, IList <ICountry> countryCollection, string processingMessage)
        {
            if (genderCollection == null)
            {
                throw new ArgumentException(nameof(genderCollection));
            }

            if (profileInfo == null)
            {
                throw new ArgumentNullException(nameof(profileInfo));
            }

            if (userDetail == null)
            {
                throw new ArgumentNullException(nameof(userDetail));
            }

            var genderDLL  = GetDropDownList.GenderListItems(genderCollection, profileInfo.GenderId);
            var CountryDLL = GetDropDownList.CountryListItem(countryCollection, profileInfo.CountryId);

            var viewModel = new ProfileModelView
            {
                User                 = userDetail,
                ProfileId            = profileInfo.ProfileId,
                CountryId            = profileInfo.CountryId,
                Address              = profileInfo.Address,
                DateOfBirth          = profileInfo.DateOfBirth,
                Nationality          = profileInfo.Nationality,
                StateOfOrigin        = profileInfo.StateOfOrigin,
                Gender               = profileInfo.Gender,
                GenderId             = profileInfo.GenderId,
                ProfileSummary       = profileInfo.ProfileSummary,
                DateCreated          = profileInfo.DateCreated,
                PictureDigitalFileId = profileInfo.PictureDigitalFileId,
                CVDigitalFileId      = profileInfo.CVDigitalFileId,
                GenderDropDown       = genderDLL,
                CountryDropDown      = CountryDLL,
                ProcessingMessage    = processingMessage ?? string.Empty
            };

            return(viewModel);
        }
Пример #4
0
        /// <summary>
        /// Creates the profile view.
        /// </summary>
        /// <param name="userInfo">The user information.</param>
        /// <param name="genderCollection">The gender collection.</param>
        /// <param name="countrycollection">The countrycollection.</param>
        /// <param name="processingMesage">The processing mesage.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentException">genderCollection</exception>
        public IProfileView CreateProfileView(IUserDetail userInfo, IList <IYourGender> genderCollection, IList <ICountry> countrycollection, string processingMesage)
        {
            if (genderCollection == null)
            {
                throw new ArgumentException(nameof(genderCollection));
            }


            var genderDLL  = GetDropDownList.GenderListItems(genderCollection, -1);
            var CountryDDL = GetDropDownList.CountryListItem(countrycollection, 161);

            var viewModel = new ProfileModelView
            {
                User              = userInfo,
                GenderDropDown    = genderDLL,
                CountryDropDown   = CountryDDL,
                ProcessingMessage = processingMesage ?? string.Empty,
                CountryId         = 161
            };

            return(viewModel);
        }