public ActionResult Edit([Bind(Include = "Name,DateInitiated,HomeAddress,City,State,ZIP,Description,FamilyName")] Ecosystem dARESystem) { if (ModelState.IsValid) { db.Entry(dARESystem).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(dARESystem)); }
public ActionResult Create([Bind(Include = "DataID,ThingID,Temperature,Date")] SensorData sensorData) { if (ModelState.IsValid) { db.SensorDatas.Add(sensorData); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ThingID = new SelectList(db.Things, "ThingID", "Name", sensorData.ThingID); return(View(sensorData)); }
public ActionResult Create([Bind(Include = "ActionID,ThingID,Name,Description")] Models.Action model) { if (ModelState.IsValid) { db.Actions.Add(model); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ThingID = new SelectList(db.Things, "ThingID", "Name", model.ThingID); return(View(model)); }
public ActionResult Edit([Bind(Include = "NoteID,SenderID,ReceiverID,Subject,Message,isNew,Alert,PushNotification,CreationDate,AlertDate")] Note note) { if (ModelState.IsValid) { db.Entry(note).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Sent")); } ViewBag.SenderID = new SelectList(db.Users, "UserID", "Username", note.SenderID); ViewBag.ReceiverID = new SelectList(db.Users, "UserID", "Username", note.ReceiverID); return(View(note)); }
public ActionResult Create([Bind(Include = "EventID,ThingID,Action,Type,Date")] Event @event) { if (ModelState.IsValid) { db.Events.Add(@event); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ThingID = new SelectList(db.Things, "ThingID", "Name", @event.ThingID); return(View(@event)); }
public ActionResult Create([Bind(Include = "ThingID,ClientID,Name,Description,StateDescriptor")] Thing thing) { if (ModelState.IsValid) { db.Things.Add(thing); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ClientID = new SelectList(db.Clients, "ClientID", "Name", thing.ClientID); return(View(thing)); }
public ActionResult Edit([Bind(Include = "ClientID,Name,Type,ClientCode,Description")] Client client) { if (ModelState.IsValid) { db.Entry(client).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(client)); }
public ActionResult Create([Bind(Include = "ScheduleID,ThingID,ActionID,Name,CronExpression,Description")] Schedule schedule) { if (ModelState.IsValid) { if (Quartz.CronExpression.IsValidExpression(schedule.CronExpression)) { db.Schedules.Add(schedule); db.SaveChanges(); return(RedirectToAction("Index")); } else { ViewBag.ThingID = new SelectList(db.Things, "ThingID", "Name", schedule.ThingID); ModelState.AddModelError("CronExpression", "Please enter a valid cron expression."); return(View(schedule)); } } ViewBag.ThingID = new SelectList(db.Things, "ThingID", "Name", schedule.ThingID); return(View(schedule)); }