Esempio n. 1
0
        public ActionResult SaveCredentials(PulseAdminModel credentials)
        {
            try
            {
                Debug.WriteLine("SaveCredentials(): START");

                PulseAdminModel data = new PulseAdminModel
                {
                    PulseApiKey = credentials.PulseApiKey,
                    FirstName   = credentials.FirstName,
                    LastName    = credentials.LastName,
                    CompanyName = credentials.CompanyName,
                    Email       = credentials.Email
                };

                DataStoreRepository.Instance.SaveData(data);

                HttpHelper.RecreateClient();

                Debug.WriteLine("SaveCredentials(): END");
                return(new HttpStatusCodeResult(HttpStatusCode.OK));
            }
            catch (Exception ex)
            {
                Debug.WriteLine("SaveCredentials(): Error: " + ex.Message);
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
        }
Esempio n. 2
0
        public ActionResult SaveApiKey(string apiKey)
        {
            try {
                Debug.WriteLine("SaveApiKey(): API: " + apiKey);

                PulseAdminModel model = DataStoreRepository.Instance.LoadData <PulseAdminModel>();
                model.PulseApiKey = apiKey;
                DataStoreRepository.Instance.SaveData(model);

                HttpHelper.RecreateClient();

                return(new HttpStatusCodeResult(HttpStatusCode.OK));
            } catch (Exception ex) {
                Debug.WriteLine("SaveApiKey(): Error: " + ex.Message);
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
        }