/// <summary> /// Create a new NoteInfo object. /// </summary> /// <param name="noteId">Initial value of the NoteId property.</param> /// <param name="userId">Initial value of the UserId property.</param> public static NoteInfo CreateNoteInfo(global::System.Guid noteId, global::System.Guid userId) { NoteInfo noteInfo = new NoteInfo(); noteInfo.NoteId = noteId; noteInfo.UserId = userId; return noteInfo; }
/// <summary> /// Deprecated Method for adding a new object to the NoteInfo EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToNoteInfo(NoteInfo noteInfo) { base.AddObject("NoteInfo", noteInfo); }
public PartialViewResult NewNote(NoteInfo note) { if (ModelState.IsValid) { if (note.NoteId == Guid.Empty) { note.NoteId = Guid.NewGuid(); note.UserId = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()); note.NotebookInfo = db.NotebookInfo.First(obj => obj.NotebookId == note.NotebookId.Value); db.NoteInfo.AddObject(note); } db.SaveChanges(); var notebookList = db.NotebookInfo.Where(obj => obj.UserId == userId); ViewBag.User = db.aspnet_Users.Single(obj => obj.UserId == userId); return PartialView("_Profiles", notebookList.ToList()); } //ViewBag.UserId = new SelectList(db.aspnet_Users, "UserId", "UserName", note.UserId); return PartialView(note); }