public object GetNotes(string Email) { var list = new List <NotesTbl>(); var label = new List <LabelTbl>(); var SharingNote = new List <CollaboratorTbl>(); var Label = from t in _context.tblLabel where t.Email == Email select t; foreach (var lbl in Label) { label.Add(lbl); } GetNotesData data = new GetNotesData(); var Notesdata = from t in _context.tblNotes where t.Email == Email select t; foreach (var item in Notesdata) { list.Add(item); } var collaborator = from t in _context.tblCollaborator where t.SharedId == Email select t; foreach (var emaildata in collaborator) { var noteid = emaildata.NoteId; NotesTbl note = _context.tblNotes.Where <NotesTbl>(t => t.ID == noteid).First(); list.Add(note); } data.noteData = list; data.label = label; return(data); }
public void UpdateNotes(int ID, [FromBody] NotesTbl tbl) { NotesTbl note = _context.tblNotes.Where <NotesTbl>(t => t.ID == ID).First(); note.Title = tbl.Title; note.Content = tbl.Content; note.IsArchive = tbl.IsArchive; note.IsPin = tbl.IsPin; note.IsTrash = tbl.IsTrash; note.ColorCode = tbl.ColorCode; note.Reminder = tbl.Reminder; note.ImageUrl = tbl.ImageUrl; // note.Collaborator = tbl.Collaborator; int result = 0; try { result = _context.SaveChanges(); } catch (Exception e) { e.ToString(); } }
public void GetNotes([FromBody] NotesTbl tbl) { if (ModelState.IsValid) { var user = new NotesTbl { Email = tbl.Email, Content = tbl.Content, Title = tbl.Title, IsArchive = tbl.IsArchive, IsPin = tbl.IsPin, ColorCode = tbl.ColorCode, Reminder = tbl.Reminder, ImageUrl = tbl.ImageUrl, }; int result = 0; try { _context.tblNotes.Add(user); result = _context.SaveChanges(); } catch (Exception ex) { ex.ToString(); } } }