private static bool ProcessAlert(string propertyNumber, string imageUrl, string predictionAsJson, int alertStatusId) { var result = false; var connString = ConfigurationManager.AppSettings["OverwatchConnectionString"]; using (var context = new OverwatchEntities(connString)) { var property = context.Properties.Where(x => x.propertyNumber == propertyNumber).FirstOrDefault(); if (property != null) { PropertyAlert propertyAlert = new PropertyAlert() { imageUrl = imageUrl, createTimestamp = DateTime.Now, propertyAlertStatusId = alertStatusId, propertyId = property.id, predictionJson = predictionAsJson }; context.PropertyAlerts.Add(propertyAlert); context.SaveChanges(); result = true; } } return(result); }
public ActionResult DeleteConfirmed(int id) { PropertyAlert propertyAlert = db.PropertyAlerts.Find(id); db.PropertyAlerts.Remove(propertyAlert); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,Title,Forename,Surname,EmailAddress,Telephone,PropertyTypeIDs,PropertyTypeTitles,MinPrice,MaxPrice,MinBedrooms,MaxBedrooms,Location,Radius,Latitude,Longitude,SubscriptionStartDate,SubscriptionExpiryDate,SubscriptionCode,DateProcessed,Active,PPPW,PCM,Portfolios,Terms,CategoryId,ClientType,SortOrder,IsAlert,AddedBy")] PropertyAlert propertyAlert) { if (ModelState.IsValid) { db.Entry(propertyAlert).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Title = new SelectList(db.ApplicantTitles, "ID", "Name", propertyAlert.Title); return(View(propertyAlert)); }
// GET: PropertyAlerts/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PropertyAlert propertyAlert = db.PropertyAlerts.Find(id); if (propertyAlert == null) { return(HttpNotFound()); } return(View(propertyAlert)); }
// GET: PropertyAlerts/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PropertyAlert propertyAlert = db.PropertyAlerts.Find(id); if (propertyAlert == null) { return(HttpNotFound()); } ViewBag.Title = new SelectList(db.ApplicantTitles, "ID", "Name", propertyAlert.Title); return(View(propertyAlert)); }