public IHttpActionResult Get_Pump_Log(postDataViewModel post) { try { var tag = post.value_1; var list = ScadaRepo.Get_PumpStatus(DateTime.Today, tag); var vm = (from x in list select new { timeStamp = x.timeStamp, run = x.run }).ToList(); return this.Ok(vm); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); return this.NotFound(); } }
public IHttpActionResult Get_WaterQuality_Log(postDataViewModel post) { try { DateTime convertDate = DateTime.ParseExact(post.dateTime, "dd-MM-yyyy", new CultureInfo("en-US")); var list = (from x in db.water_quality_log1hr where SqlFunctions.DatePart("day", x.LocalCol) == convertDate.Day && SqlFunctions.DatePart("month", x.LocalCol) == convertDate.Month && SqlFunctions.DatePart("year", x.LocalCol) == convertDate.Year orderby x.LocalCol ascending select x).ToList(); if (list.Count > 0) return this.Ok(list); else return this.NotFound(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); return this.NotFound(); } }
public IHttpActionResult Get_Power_Log(postDataViewModel post) { try { DateTime convertDate = DateTime.ParseExact(post.dateTime, "dd-MM-yyyy", new CultureInfo("en-US")); var list = ScadaRepo.Get_Power_Log(convertDate); return this.Ok(list); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); return this.NotFound(); } }