// GET: geoFence public ActionResult createFence() { int id = vendorId(User.Identity.Name); fenceModel m = new fenceModel(); m.vendorId = id; var context = new promoLacDbEntities(); var r = context.userPackages.Where(x => x.vendorId == id).FirstOrDefault(); m.allowedFenceHours = Convert.ToInt32(r.remainingFencingHours); return(View(m)); }
public ActionResult createFence(fenceModel f) { tempFence tf = new tempFence(); tf.Latitude = f.latitude.ToString(); tf.Longitude = f.longitude.ToString(); tf.Notification_ = f.notification; tf.TimeStamp = DateTime.Now.AddHours(f.hr).ToString("MM/dd/yyyy HH:mm:ss"); tf.Radius = f.radius.ToString(); IFirebaseConfig mes = new FirebaseConfig { AuthSecret = "CwnE0VGXMqxNxcY5YSWVNcL7IAM3hfqRuSiNjWm5", BasePath = "https://xdadeveloperes.firebaseio.com/" }; IFirebaseClient mfc; mfc = new FireSharp.FirebaseClient(mes); var data = tf; PushResponse r = mfc.Push("Fences_" + "/", data); updateFencingHours(Convert.ToInt32(f.vendorId), f.hr); var context = new promoLacDbEntities(); fence fence_ = new fence(); fence_.latitude = f.latitude; fence_.longitude = f.longitude; fence_.startTime = DateTime.Now; fence_.endTime = DateTime.Now.AddHours(f.hr); fence_.notification = f.notification; fence_.radius = f.radius; fence_.vendorId = f.vendorId; fence_.area = f.AreaName; context.fences.Add(fence_); context.SaveChanges(); return(Json(new { success = true, message = "dddd" }, JsonRequestBehavior.AllowGet)); }