public bool AddNotesCollaborator([FromBody] CollaboratorTbl model) { var Labeldata = from t in _context.tblCollaborator where t.Email == model.Email select t; foreach (var data1 in Labeldata.ToList()) { if (data1.NoteId == model.NoteId && data1.SharedId == model.SharedId) { return(false); } } var data = new CollaboratorTbl { Email = model.Email, SharedId = model.SharedId, NoteId = model.NoteId }; int result = 0; _context.tblCollaborator.Add(data); result = _context.SaveChanges(); return(true); }
public object AddNotesCollaborator([FromBody] CollaboratorTbl tbl) { var labeldata = from t in context.tblCollaborator where t.Email == tbl.Email select t; foreach (var label in labeldata.ToList()) { if (label.ID == tbl.ID && label.SharedId == tbl.SharedId) { return(BadRequest()); } } var data = new CollaboratorTbl { ID = tbl.ID, NoteId = tbl.NoteId, Email = tbl.Email, SharedId = tbl.SharedId }; int result = 0; context.tblCollaborator.Add(data); result = context.SaveChanges(); return(Ok()); }