// PUT: api/Data/5 public HttpResponseMessage Put([FromBody] DataPointModel value) { access.EditDataPoint(value); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.NoContent); return(response); }
// GET: api/Data/5 public DataPointModel Get(int id) { DataPointModel data = new DataPointModel(); data = access.GetDataPointByID(id); return(data); }
// POST: api/Data public HttpResponseMessage Post([FromBody] DataPointModel value) { int id; id = access.AddDataPoint(value); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created); response.Headers.Location = new Uri(Request.RequestUri, String.Format("data/{0}", id)); return(response); }
public static DataPointModel Map(DataPoint entity) { DataPointModel model = new DataPointModel(); model.ShortId = entity.ShortId; model.TimeStamp = entity.UtcTimeStamp; model.Value = entity.Value; model.Sum = entity.Sum; model.SumSqr = entity.SumSqr; model.Min = entity.Min; model.Max = entity.Max; model.Count = entity.Count; return(model); }
// GET: DataPoint/Edit/5 public ActionResult Edit(int id) { var dataPoint = dataPointService.GetDataPoint(id); var dataPointModel = new DataPointModel { Date = dataPoint.Date, OdometerReading = dataPoint.OdometerReading, TotalCost = dataPoint.TotalCost, GallonsPurchased = dataPoint.GallonsPurchased, PricePerGallon = dataPoint.PricePerGallon, DistanceSinceLastFill = dataPoint.DistanceSinceLastFill }; return(View(dataPointModel)); }
public ActionResult Create(DataPointModel dataPoint) { try { var contract = new MileageDataPoint { OdometerReading = dataPoint.OdometerReading, TotalCost = dataPoint.TotalCost, GallonsPurchased = dataPoint.GallonsPurchased }; dataPointService.CreateDataPoint(contract); return(RedirectToAction("Index")); } catch { return(View()); } }
public RandomViewChartViewModel() { Rnd = new Random(); DpModel = new DataPointModel(); DpModels = new ObservableCollection <DataPointModel>(); TestSerie = new TestSeries(); TestSeriesOc = new ObservableCollection <TestSeries> { TestSeries.Create(SeriesTypeEnum.Line, new ObservableCollection <TestSeriesData> { TestSeriesData.Create(1, 5, Rnd.Next(0, 100)), TestSeriesData.Create(2, 10, 20), TestSeriesData.Create(3, 15, Rnd.Next(0, 100)), TestSeriesData.Create(4, 20, 35), TestSeriesData.Create(5, 25, Rnd.Next(0, 100)), TestSeriesData.Create(6, 30, Rnd.Next(0, 100)), TestSeriesData.Create(7, 35, 65), TestSeriesData.Create(8, 40, Rnd.Next(0, 100)), TestSeriesData.Create(9, 45, Rnd.Next(0, 100)), TestSeriesData.Create(10, 50, Rnd.Next(0, 100)) }), TestSeries.Create(SeriesTypeEnum.Point, new ObservableCollection <TestSeriesData> { TestSeriesData.Create(4, 20, 35) }), TestSeries.Create(SeriesTypeEnum.Point, new ObservableCollection <TestSeriesData> { TestSeriesData.Create(7, 35, 65) }) }; TestSerieData = new TestSeriesData(); TestSeriesDataOc = new ObservableItemCollection <TestSeriesData>(); ButtonCommand = new DelegateCommand(ButtonExecuted); }
public ActionResult Edit(int id, DataPointModel dataPoint) { try { var contract = new MileageDataPoint { OdometerReading = dataPoint.OdometerReading, TotalCost = dataPoint.TotalCost, GallonsPurchased = dataPoint.GallonsPurchased, PricePerGallon = dataPoint.GallonsPurchased / dataPoint.TotalCost, DistanceSinceLastFill = dataPoint.DistanceSinceLastFill, Date = dataPoint.Date }; dataPointService.EditDataPoint(id, contract); return(RedirectToAction("Index")); } catch { return(View()); } }