public ActionResult UpdateUserProfile(UpdatUserProfileModel updatUserProfile) { DatabaseController databaseController = new DatabaseController(); databaseController.UpdateUser(updatUserProfile); return(View()); }
public ActionResult UpdateUser(UpdatUserProfileModel updateUserProfile) { // PushResponse pushResponse = client.Push("Register/", registerData); // registerData.RegisterID = pushResponse.Result.name; if (client == null) { getClient(); } FirebaseResponse getResponse = client.Get(@"Register/" + updateUserProfile.Username); if (getResponse == null) { ViewBag.message("no user"); } else { var registerUser = getResponse.ResultAs <Register>(); var updateUserProfileData = registerUser; if (updateUserProfile.Password == registerUser.Password) { if (updateUserProfile.FirstName != null) { updateUserProfileData.FirstName = updateUserProfile.FirstName; var setResponse = client.Update(@"Register/" + updateUserProfileData.Username, updateUserProfileData); } if (updateUserProfile.LastName != null) { updateUserProfileData.LastName = updateUserProfile.LastName; var setResponse = client.Update(@"Register/" + updateUserProfileData.Username, updateUserProfileData); } if (updateUserProfile.Gender != null) { updateUserProfileData.Gender = updateUserProfile.Gender; var setResponse = client.Update(@"Register/" + updateUserProfileData.Username, updateUserProfileData); } if (updateUserProfile.Address != null) { updateUserProfileData.Address = updateUserProfile.Address; var setResponse = client.Update(@"Register/" + updateUserProfileData.Username, updateUserProfileData); } if (updateUserProfile.Mobile != null) { updateUserProfileData.Mobile = updateUserProfile.Mobile; var setResponse = client.Update(@"Register/" + updateUserProfileData.Username, updateUserProfileData); } if (updateUserProfile.BirthDate != null & updateUserProfileData.BirthMonth != null & updateUserProfileData.BirthYear != null) { FirebaseResponse setResponse; updateUserProfileData.BirthDate = updateUserProfile.BirthDate; updateUserProfileData.BirthMonth = updateUserProfile.BirthMonth; updateUserProfileData.BirthYear = updateUserProfile.BirthYear; setResponse = client.Update(@"Register/" + updateUserProfileData.Username, updateUserProfileData); setResponse = client.Update(@"Register/" + updateUserProfileData.Username, updateUserProfileData); setResponse = client.Update(@"Register/" + updateUserProfileData.Username, updateUserProfileData); } } return(View()); } return(View()); }