//contains a function that receives details from a class through an object
        //this object then has its data converted into json format as defined in the variable name JsonContent
        public static async Task <bool> SaveNewFeature(NewFeature feature)
        {
            var Client = new HttpClient(); //special guy ...has a lot of libraries that attribute to post get
                                           //put and others relative to the async

            var JsonContent = JsonConvert.SerializeObject(feature);


            //mode of transfer over the hhtp protocol
            //json is not enough moving data over a webservice needs to be undertandable
            //further doumentation is in STRINGCONTENT();
            var httpContent = new StringContent(JsonContent, Encoding.UTF8, "application/json");

            //URL to the web service created earlier.
            //http://localhost:51217
            //https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/await for the asyn await documentation
            var Response = await Client.PostAsync("http://localhost:51217/SaveNewFeature", httpContent);

            //just to make sure its readable.
            //just in case
            //its being received as a bool so
            var RepsonseString = await Response.Content.ReadAsStringAsync();

            //..sorry ..so...
            if (RepsonseString == "false")
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 2
0
        public JsonResult Announcement(string deployDate = null)
        {
            // return a empty feature for annonymous user; client side needs to have logic to handle this
            if (!AuthorizationProvider.IsAuthenticated())
            {
                return(Json(new NewFeature(), JsonRequestBehavior.AllowGet));
            }

            NewFeatureProvider provider   = new NewFeatureProvider(_dbContext);
            NewFeature         newFeature = provider.Get(deployDate);

            return(Json(newFeature, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
 public void CommandNewFeature(string feature)
 {
     if (Features == null)
     {
         Features = new List <string>();
         Features.Add(feature);
         NewFeature?.Invoke(this, null);
     }
     else
     {
         Features.Add(feature);
         NewFeature?.Invoke(this, null);
     }
 }
Exemplo n.º 4
0
        public async Task <ActionResult> SaveNewFeature()
        {
            //this hear is picking entries from the input textboxes and
            var feature = new NewFeature();
            //pick values from

            var success = await NewFeatureFinalWebProcessor.ProcessNewFeature(feature);

            if (success == true)
            {
                ViewBag.Message = "Entries added successfully";
            }

            else
            {
                ViewBag.Message = "Could not perform new entry";
            }
            return(View());
        }
Exemplo n.º 5
0
        public NewFeature Get(string deployDate)
        {
            NewFeature newFeature = null;

            if (string.IsNullOrEmpty(deployDate))
            {
                newFeature = _dbContext.NewFeatures
                             .OrderByDescending(f => f.DeployDate)
                             .FirstOrDefault();
            }
            else
            {
                DateTime dateToMatch;
                if (DateTime.TryParse(deployDate, out dateToMatch))
                {
                    newFeature = _dbContext.NewFeatures
                                 .Where(f => f.DeployDate == dateToMatch)
                                 .FirstOrDefault();
                }
            }
            return(newFeature);
        }
Exemplo n.º 6
0
        public void FuncFactory_ShouldBeV2()
        {
            var feat = new NewFeature().Process(Constants.FeatFlag);

            Assert.IsTrue(feat == "here is the 1, and this is the cool");
        }
Exemplo n.º 7
0
        public void FuncFactory_ShouldBeV1String()
        {
            var feat = new NewFeature().Process("");

            Assert.IsTrue(feat == "here is the cool, and this is the 1");
        }
 public static async Task <bool> ProcessNewFeature(NewFeature feature)
 {
     //process, calculate, format etc
     //does nothing just yet only returns as part of a process.
     return(await NewFeatureFinalWebRepository.SaveNewFeature(feature));
 }