public ActionResult Create(FoodLogEntry foodLogEntry)
        //public ActionResult Create([Bind(Include = "Id,Quantity,Description,MealTime,Tags,Calories,ProteinInGrams,FatInGrams,CarbohydratesInGrams,SodiumInGrams,Color")] FoodLogEntry foodLogEntry)
        {
            if (ModelState.IsValid)
            {
                repository.Create(foodLogEntry);

                Trace.TraceInformation("Created FoodLogEntry {0}", foodLogEntry.Description);

                // Application Insights - Track Events
                var telemetry = new TelemetryClient();
                telemetry.TrackTrace("Created FoodLogEntry " + foodLogEntry.Id.ToString() + " " + foodLogEntry.Description);
                telemetry.TrackEvent("Created FoodLogEntry " + foodLogEntry.Id.ToString() + " " + foodLogEntry.Description);
                //if (!string.IsNullOrEmpty(foodLogEntry.Color))
                //{
                //    telemetry.TrackEvent("Creating new food with color field " + foodLogEntry.Id.ToString() + " Color: " + foodLogEntry.Color + " Description:" + foodLogEntry.Description);
                //}

                return(RedirectToAction("Index"));
            }

            return(View(foodLogEntry));
        }
Beispiel #2
0
        public ActionResult Create([Bind(Include = "Id,Quantity,Description,MealTime,Tags,Calories,ProteinInGrams,FatInGrams,CarbohydratesInGrams,SodiumInGrams")] FoodLogEntry foodLogEntry)
        {
            if (ModelState.IsValid)
            {
                repository.Create(foodLogEntry);

                Trace.TraceInformation("Created Nutrition {0}", foodLogEntry.Description);

                // Application Insights - Track Events
                Utilities.TelemetryClientHelper.TrackEvent("Created Nutrition");

                return(RedirectToAction("Index"));
            }

            return(View(foodLogEntry));

            //Comment
        }
 // POST: api/FoodLogApi
 public void Post([FromBody] FoodLogEntry value)
 {
     foodDb.Create(value);
 }