public ActionResult Edit(Sample sample) { if (ModelState.IsValid) { db.Samples.Attach(sample); db.ObjectStateManager.ChangeObjectState(sample, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } return View(sample); }
public ActionResult Create(Sample sample) { if (ModelState.IsValid) { sample.SampleID = Guid.NewGuid(); db.Samples.AddObject(sample); db.SaveChanges(); return RedirectToAction("Index"); } return View(sample); }
/// <summary> /// Deprecated Method for adding a new object to the Samples EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToSamples(Sample sample) { base.AddObject("Samples", sample); }
/// <summary> /// Create a new Sample object. /// </summary> /// <param name="sampleID">Initial value of the SampleID property.</param> public static Sample CreateSample(global::System.Guid sampleID) { Sample sample = new Sample(); sample.SampleID = sampleID; return sample; }