public IActionResult AddCollaborator([FromBody] Collaborator collaboratorModel) { try { var AccountId = Convert.ToInt32(HttpContext.Items["userId"]); collaboratorModel.SenderEmail = Convert.ToString(HttpContext.Items["email"]); Collaborator collaborator = _collaboratorService.AddCollaborator(AccountId, collaboratorModel.SenderEmail, collaboratorModel); if (collaborator == null) { return(NotFound(new ServiceResponse <Collaborator> { StatusCode = (int)HttpStatusCode.NotFound, Message = "Internal Server Error", Data = null })); } _msmq.AddToQueue(collaboratorModel.RecieverEmail + " " + "Collaborated Successfully by" + collaboratorModel.SenderEmail + " " + System.DateTime.Now.ToString()); return(Ok(new ServiceResponse <Collaborator> { StatusCode = (int)HttpStatusCode.OK, Message = "Added Successfully", Data = collaborator })); } catch (Exception) { return(BadRequest(new ServiceResponse <Collaborator> { StatusCode = (int)HttpStatusCode.BadRequest, Message = "Page Not Found", Data = null })); } }
public async Task <IActionResult> AddCollabortor([FromBody] CollaboratorRequestDto collaborator) { int userId = Convert.ToInt32(HttpContext.Items["userId"]); string email = (string)HttpContext.Items["email"]; var addedCollaborator = await _service.AddCollaborator(email, userId, collaborator); return(Ok(new { Data = collaborator, StatusCode = (int)HttpStatusCode.Created, Message = ResponseMessages.SUCCESS })); }