// Submits a new profile to the server, overwriting existing profile on server public static void SubmitNewProfile(Profile profile) { WWWForm form = new WWWForm(); NewProfileRequest m = new NewProfileRequest(); m.newProfile = profile; m.uid = profile.uid; m.timestamp = GetTimeStamp(); m.token = ProfileMessenger.Password; form.AddField("message", JsonUtility.ToJson(m)); WWW w = new WWW(UpdateProfileUrl, form); // wait until complete while (!w.isDone) { } if (!string.IsNullOrEmpty(w.error)) { Debug.Log(w.error); } else { Debug.Log(w.text); ThrowExceptionIfError(w.text); Debug.Log("Finished submitting profile"); GlobalState.LoadProfileWithUid(profile.uid); } }
public IActionResult Profile(NewProfileRequest request) { _cookiesServices = new CookiesServices(HttpContext.Response.Cookies, HttpContext.Request.Cookies); if (string.IsNullOrEmpty(HttpContext.Request.Cookies[CookiesServices.nicknameCookie]) || string.IsNullOrEmpty(HttpContext.Request.Cookies[CookiesServices.nameCookie])) { return(LocalRedirect("/")); } string nickname = _cookiesServices.Get(CookiesServices.nicknameCookie); string path = HttpContext.Request.Path; DataPagePrivate dataPage = _pageDataServices.GetDataPagePrivate(nickname, path); if (!dataPage.hasPermisson) { return(LocalRedirect("/")); } ViewBag.menu = dataPage.menu; ViewBag.titleHeader = dataPage.TittleHeader; ViewBag.userName = _cookiesServices.Get(CookiesServices.nameCookie); ViewData["Title"] = dataPage.TittlePage; ViewBag.updateProfile = _permissonsOfProfileModelServices.trySaveProfileAndPermissons(request); ViewBag.LtsProfiles = _profileModelServices.findAll(); ViewBag.LtsPermissons = _permissionsModelServices.findAll(); return(View()); }
public async Task <IActionResult> CreateUser([FromBody] NewUser userProfile) { var request = new NewProfileRequest(userProfile); await _mediator.Send(request); return(Ok("User has been created")); }
public void NewProfile() { var request = new NewProfileRequest(ProfileRequests.NewProfile); request.Parse(); Assert.Equal("xxxx", request.SessionKey); Assert.Equal("spyguy", request.NewNick); }
public Profile TrySaveProfile(NewProfileRequest request) { Boolean saveSuccess = this.saveProfile(request); if (saveSuccess) { return(_context.profiles.Last()); } return(null); }
public async Task <IActionResult> CreateProfile([FromBody] NewProfileRequest dto) { var profile = new Profile { Id = Guid.NewGuid(), FacebookId = null, FavoriteBar = await DbContext.Bars.FindAsync(dto.FavoriteBarId), Bio = dto.Bio }; DbContext.Profiles.Add(profile); await DbContext.SaveChangesAsync(); return(Ok(profile)); }
public Boolean saveProfile(NewProfileRequest request) { Profile newProfile = new Profile(); newProfile.IsEnable = true; newProfile.ProfileId = request.Key; newProfile.ProfileName = request.ProfileName; if (request.Key > 0) { return(this.saveProfile(newProfile)); } else { return(this.addProfile(newProfile)); } }
public NewProfileHandler(ISession client, Dictionary <string, string> recv) : base(client, recv) { _request = new NewProfileRequest(recv); }
public IActionResult PermissonsOfProfile(NewProfileRequest request) { ViewBag.updateProfile = _permissonsOfProfileModelServices.trySaveProfileAndPermissons(request); return(LocalRedirect("/Config/PermissonsOfProfile")); }
public NewProfileEvent(NewProfileRequest request) : base(DateTime.Now, "newProfile") { Data = request.newUser; }
public Boolean trySaveProfileAndPermissons(NewProfileRequest request) { Profile profile = new Profile(); if (request.Key > 0) { profile.ProfileId = request.Key; this.deletePermissonsOfProfile(profile); } profile = _profileModelServices.TrySaveProfile(request); Boolean saveSuccess = false; if (profile != null) { if (request.PermissonsSelected != null) { List <Permissions> permSelected = _permissionsModelServices.findByIds(request.PermissonsSelected); if (request.Key > 0) { permSelected.Add(new Permissions(11)); } if (permSelected.Count > 0 && profile.ProfileId > 0) { List <Permissions> pathernPermissons = new List <Permissions>(); foreach (Permissions perm in permSelected) { int pttPermissonId = perm.PatternPermissonId; if (pathernPermissons.Count == 0) { Permissions patternPerm = new Permissions(); patternPerm.PermissionsId = pttPermissonId; pathernPermissons.Add(patternPerm); } else { Boolean hadInclud = false; foreach (Permissions patt in pathernPermissons) { if (patt.PermissionsId == pttPermissonId) { hadInclud = true; } } if (!hadInclud) { Permissions patternPerm = new Permissions(); patternPerm.PermissionsId = pttPermissonId; pathernPermissons.Add(patternPerm); } } } saveSuccess = this.saveManyPermissonsToProfile(pathernPermissons, profile); if (saveSuccess) { saveSuccess = this.saveManyPermissonsToProfile(permSelected, profile); } } else { _logger.LogError("[Permissons not Found]"); } } else { List <Permissions> permSelected = new List <Permissions>(); permSelected.Add(new Permissions(11)); saveSuccess = this.saveManyPermissonsToProfile(permSelected, profile); } } else { _logger.LogError("[Profile Not Save]"); } return(saveSuccess); }