public ActionResult Create(String Data, string LocX, string LocY, int ProjectID) { if (!ModelState.IsValid) return View(); try { Note note = new Note(); note.Data = Data; note.LocX = LocX; note.LocY = LocY; note.ProjectID = ProjectID; note.DeveloperID = _dataModel.Developers.Single(d => d.UserName == User.Identity.Name).DeveloperID; _dataModel.AddToNotes(note); _dataModel.SaveChanges(); return RedirectToAction("Index"); } catch { return RedirectToAction("Index"); } }
/// <summary> /// Create a new Note object. /// </summary> /// <param name="noteID">Initial value of the NoteID property.</param> /// <param name="data">Initial value of the Data property.</param> /// <param name="projectID">Initial value of the ProjectID property.</param> /// <param name="developerID">Initial value of the DeveloperID property.</param> public static Note CreateNote(global::System.Int32 noteID, global::System.String data, global::System.Int32 projectID, global::System.Int32 developerID) { Note note = new Note(); note.NoteID = noteID; note.Data = data; note.ProjectID = projectID; note.DeveloperID = developerID; return note; }
/// <summary> /// Deprecated Method for adding a new object to the Notes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToNotes(Note note) { base.AddObject("Notes", note); }