public IActionResult Index() { if (!HttpContext.Request.Query.TryGetValue("lat", out StringValues lat)) { return(BadRequest("lat must be sent")); } if (!HttpContext.Request.Query.TryGetValue("lng", out StringValues lng)) { return(BadRequest("lng must be sent")); } if (!HttpContext.Request.Query.TryGetValue("tz", out StringValues tz)) { return(BadRequest("tz must be sent")); } if (!double.TryParse(lat, out double dblLat)) { return(BadRequest("lat is an incorrect double")); } if (!double.TryParse(lng, out double dblLng)) { return(BadRequest("lng is an incorrect double")); } if (!double.TryParse(tz, out double dblTZ)) { return(BadRequest("tz is an incorrect double")); } var dt = DateTime.Now; if (HttpContext.Request.Query.TryGetValue("dt", out StringValues strdt)) { if (!DateTime.TryParse(strdt, out dt)) { return(BadRequest("dt is an incorrect double")); } } var p = new PrayTime(); p.setCalcMethod(PrayTime.Jafari); Console.WriteLine($"lat: { dblLat}"); Times = p.getDatePrayerTimes(dt.Year, dt.Month, dt.Day, dblLng, dblLat, dblTZ, 7); return(Ok(Times)); }
static void Main ( string [ ] args ) { PrayerTime p = new PrayTime(); double lo = 25; double la = 55; int y = 0 , m = 0 , d = 0 , tz = 0; DateTime cc = DateTime.Now; y = cc.Year; m = cc.Month; d = cc.Day; tz = TimeZone.CurrentTimeZone.GetUtcOffset(new DateTime (y,m,d)).Hours; String [] s ; p.setCalcMethod ( 2 ); p . setAsrMethod ( 0 ); s = p . getDatePrayerTimes ( y , m , d , lo , la , tz ); for(int i = 0 ; i < s.Length ; ++i ) { Console . WriteLine ( s [ i ] ); } }
static void Main(string [] args) { PrayerTime p = new PrayTime(); double lo = 25; double la = 55; int y = 0, m = 0, d = 0, tz = 0; DateTime cc = DateTime.Now; y = cc.Year; m = cc.Month; d = cc.Day; tz = TimeZone.CurrentTimeZone.GetUtcOffset(new DateTime(y, m, d)).Hours; String [] s; p.setCalcMethod(2); p.setAsrMethod(0); s = p.getDatePrayerTimes(y, m, d, lo, la, tz); for (int i = 0; i < s.Length; ++i) { Console.WriteLine(s [i]); } }