Esempio n. 1
0
        public async Task <IActionResult> AddCollaborators(int NoteId, AddCollaboratorRequest collaborator)
        {
            try
            {
                if (collaborator.CollaboratorId != 0 && NoteId != 0)
                {
                    var userId = TokenUserId();
                    AddCollaboratorResponce data = await note.AddCollaborators(NoteId, userId, collaborator);

                    if (data.CollaborationRecordId != 0)
                    {
                        return(Ok(new { success = true, Meassage = "Add Collabrators SucessessFully", data }));
                    }
                    else
                    {
                        return(BadRequest(new { success = false, Meassage = "Add Collabrators unsuceessful" }));
                    }
                }
                else
                {
                    return(BadRequest(new { success = false, Meassage = "Invalid Credentials" }));
                }
            }
            catch (Exception e)
            {
                return(BadRequest(new { success = false, Meassage = e.Message }));
            }
        }