Exemple #1
0
            /// <summary>
            /// Contains the specified profile update to the local store.
            /// </summary>
            /// <param name="profileUpdate">The profile update.</param>
            /// <exception cref="System.ArgumentNullException">profileUpdate</exception>
            public bool Contains(ProfileUpdate profileUpdate)
            {
                if (profileUpdate == null)
                {
                    throw new ArgumentNullException("profileUpdate");
                }

                return(ProfileUpdates.Contains(profileUpdate));
            }
Exemple #2
0
            /// <summary>
            /// Adds the specified profile update to the local store.
            /// </summary>
            /// <param name="profileUpdate">The profile update.</param>
            /// <exception cref="System.ArgumentNullException">profileUpdate</exception>
            public void Add(ProfileUpdate profileUpdate)
            {
                if (profileUpdate == null)
                {
                    throw new ArgumentNullException("profileUpdate");
                }

                ProfileUpdates.Add(profileUpdate);
            }
Exemple #3
0
        public JsonResult EditStudentProfile(StudentprofileViewModel profileViewModel, ProfileEditor editOperation)
        {
            try
            {
                var token = _tokenValidator.Validate(HttpContext);
                if (!token.Success)
                {
                    return(Json(new ReturnData <string>
                    {
                        Success = false,
                        NotAuthenticated = true,
                        Message = $"Unauthorized:-{token.Message}",
                    }));
                }

                var settings       = _context.PortalConfigs.Any(c => c.Code == "008" && c.Status);
                var profileUpdates = new ProfileUpdates
                {
                    TelNo                = profileViewModel.Telno,
                    Email                = profileViewModel.Email,
                    HomeAddress          = profileViewModel.Homeaddress,
                    UserCode             = profileViewModel.AdmnNo,
                    DateCreated          = DateTime.Now,
                    AllowedAdminApproval = true,
                    Status               = false
                };

                if (settings)
                {
                    var updateProfileResults = _unisolApiProxy.EditStudentProfile(profileViewModel, classStatus, editOperation).Result;
                    var jdata = JsonConvert.DeserializeObject <ReturnData <string> >(updateProfileResults);
                    if (jdata.Success)
                    {
                        var portalUser = _context.Users.FirstOrDefault(u => u.UserName.ToUpper().Equals(profileViewModel.AdmnNo.ToUpper()));
                        if (portalUser != null)
                        {
                            portalUser.Email = profileViewModel.Email;
                            _context.SaveChanges();
                        }

                        return(Json(new ReturnData <string>
                        {
                            Success = true,
                            Message = "Profile Updated successfully"
                        }));
                    }
                }

                _context.ProfileUpdate.Add(profileUpdates);
                _context.SaveChanges();

                return(Json(new ReturnData <string>
                {
                    Success = false,
                    Message = "Profile Updated Request received, We shall contact yo shortly"
                }));
            }
            catch (Exception ex)
            {
                return(Json(new ReturnData <string>
                {
                    Success = false,
                    Message = "An error occured while trying to update the profile, please try again"
                }));
            }
        }