コード例 #1
0
        public async void Pin_User_Matter()
        {
            var pinRequestVM = new PinRequestMatterVM()
            {
                Client = new Client()
                {
                    Id   = "123456",
                    Name = "Microsoft",
                    Url  = "https://microsoft.sharepoint.com/teams/mcuisite"
                },
                MatterData = new MatterData()
                {
                    MatterUrl                 = "https://svalli.sharepoint.com/sites/mc/e0421c5e7fbf704023871b2acf64370m/Forms/AllItems.aspx",
                    HideUpload                = "false",
                    MatterAreaOfLaw           = "Intellectual Property;",
                    MatterClient              = "Microsoft",
                    MatterClientId            = "100002",
                    MatterCreatedDate         = "2016-02-18T11:19:05.000Z",
                    MatterDescription         = "For Matter Center",
                    MatterGuid                = "9c069bd7e681628e5107a87bfc49e648",
                    MatterID                  = "123456",
                    MatterModifiedDate        = "2016-03-07T23:23:49Z",
                    MatterPracticeGroup       = "Litigation;",
                    MatterName                = "For Matter Center",
                    MatterResponsibleAttorney = "Matter Center",
                    MatterSubAreaOfLaw        = "Trademark;",
                    MatterClientUrl           = "https://svalli.sharepoint.com/sites/mc"
                }
            };

            using (var testClient = testServer.CreateClient().AcceptJson())
            {
                var response = await testClient.PostAsJsonAsync("http://localhost:58775/api/v1/matter/pinmatter", pinRequestVM);

                var result = response.Content.ReadAsStringAsync().Result;
                Assert.NotNull(result);
            }
        }
コード例 #2
0
        /// <summary>
        /// unpin the matter
        /// </summary>
        /// <param name="client">Client object containing Client data</param>
        /// <param name="details">Term Store object containing Term store data</param>
        /// <returns>Returns JSON object to the client</returns>        ///
        public async Task <IActionResult> UnPin([FromBody] PinRequestMatterVM pinRequestMatterVM)
        {
            try
            {
                spoAuthorization.AccessToken = HttpContext.Request.Headers["Authorization"];
                #region Error Checking
                ErrorResponse errorResponse = null;
                //if the token is not valid, immediately return no authorization error to the user
                if (errorResponse != null && !errorResponse.IsTokenValid)
                {
                    return(matterCenterServiceFunctions.ServiceResponse(errorResponse, (int)HttpStatusCode.Unauthorized));
                }
                if (pinRequestMatterVM == null && pinRequestMatterVM.Client == null && pinRequestMatterVM.MatterData == null)
                {
                    errorResponse = new ErrorResponse()
                    {
                        Message     = errorSettings.MessageNoInputs,
                        ErrorCode   = HttpStatusCode.BadRequest.ToString(),
                        Description = "No input data is passed"
                    };
                    return(matterCenterServiceFunctions.ServiceResponse(errorResponse, (int)HttpStatusCode.BadRequest));
                }
                #endregion
                var isMatterUnPinned = await matterRepositoy.UnPinRecordAsync <PinRequestMatterVM>(pinRequestMatterVM);

                var matterUnPinned = new
                {
                    IsMatterUnPinned = isMatterUnPinned
                };
                return(matterCenterServiceFunctions.ServiceResponse(matterUnPinned, (int)HttpStatusCode.OK));
            }
            catch (Exception ex)
            {
                customLogger.LogError(ex, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable);
                throw;
            }
        }
コード例 #3
0
        public async void UnPin_User_Matter()
        {
            var pinRequestVM = new PinRequestMatterVM()
            {
                Client = new Client()
                {
                    Id   = "123456",
                    Name = "Microsoft",
                    Url  = "https://microsoft.sharepoint.com/teams/mcuisite"
                },
                MatterData = new MatterData()
                {
                    MatterName = "https://svalli.sharepoint.com/sites/mc/e0421c5e7fbf704023871b2acf64370m/Forms/AllItems.aspx"
                }
            };

            using (var testClient = testServer.CreateClient().AcceptJson())
            {
                var response = await testClient.PostAsJsonAsync("http://localhost:58775/api/v1/matter/unpinmatter", pinRequestVM);

                var result = response.Content.ReadAsStringAsync().Result;
                Assert.NotNull(result);
            }
        }