Exemplo n.º 1
0
 public IActionResult AddCollaborator(int noteId, CollaborateMultiple collaborator)
 {
     try
     {
         var    user = HttpContext.User;
         bool   status;
         string message;
         if (user.HasClaim(c => c.Type == "TokenType"))
         {
             if (user.Claims.FirstOrDefault(c => c.Type == "TokenType").Value == "Login")
             {
                 int ownerId            = Convert.ToInt32(user.Claims.FirstOrDefault(c => c.Type == "Id").Value);
                 NoteResponseModel data = this._notesBusiness.Collaborations(noteId, collaborator, ownerId);
                 if (data != null)
                 {
                     status  = true;
                     message = "collaborated successfully";
                     return(this.Ok(new { status, message, data }));
                 }
             }
         }
         status  = false;
         message = "collaboration failed";
         return(this.NotFound(new { status, message }));
     }
     catch (Exception e)
     {
         return(this.BadRequest(e.Message));
     }
 }
Exemplo n.º 2
0
 public NoteResponseModel Collaborations(int noteId, CollaborateMultiple collaboratorRequest, int ownerId)
 {
     if (noteId != 0 && collaboratorRequest.CollaboratorRequestModels.Count != 0)
     {
         return(this._notesRepository.Collaborations(noteId, collaboratorRequest, ownerId));
     }
     else
     {
         return(null);
     }
 }