public ActionResult Create(events events) { if (ModelState.IsValid) { db.events.AddObject(events); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.LecturerID = new SelectList(db.lecturers, "LecturerID", "Name", events.LecturerID); return View(events); }
public ActionResult Create(events events) { if (ModelState.IsValid) { events.Key = EncryptedString.rundomKey(); events.CreatedDate = DateTime.UtcNow; context.events.AddObject(events); context.SaveChanges(); return RedirectToAction("Index"); } return View(events); }
public ActionResult Edit(events events) { if (ModelState.IsValid) { db.events.Attach(events); db.ObjectStateManager.ChangeObjectState(events, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.LecturerID = new SelectList(db.lecturers, "LecturerID", "Name", events.LecturerID); return View(events); }
public ActionResult Edit(events events) { if (ModelState.IsValid) { events changedEvent= context.events.Single(e => e.EventID == events.EventID); changedEvent.Title = events.Title; changedEvent.Details = events.Details; changedEvent.Status = events.Status; changedEvent.LecturerID = events.LecturerID; changedEvent.CreatedDate = DateTime.Now; //context.events.Attach(events); // context.ObjectStateManager.ChangeObjectState(events, EntityState.Modified); context.SaveChanges(); return RedirectToAction("Index"); } return View(events); }
/// <summary> /// Create a new events object. /// </summary> /// <param name="eventID">Initial value of the EventID property.</param> /// <param name="title">Initial value of the Title property.</param> /// <param name="key">Initial value of the Key property.</param> /// <param name="status">Initial value of the Status property.</param> public static events Createevents(global::System.Int32 eventID, global::System.String title, global::System.String key, global::System.Int32 status) { events events = new events(); events.EventID = eventID; events.Title = title; events.Key = key; events.Status = status; return events; }
/// <summary> /// Deprecated Method for adding a new object to the events EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToevents(events events) { base.AddObject("events", events); }
public void Delete(events entity) { Repository.Delete(entity); }
public void Add(events entity) { Repository.Add(entity); }