Exemple #1
0
        public IHttpActionResult Put([FromUri] Guid paragraphId, [FromBody] ParagraphModel paragraphModel)
        {
            try
            {
                Utils.IsAValidToken(Request, AuthorizationBusinessLogic);

                paragraphModel.Id = paragraphId;

                ParagraphBusinessLogic.ModifyParagraph(paragraphModel.ToEntity());

                AuditLogBussinesLogic.CreateLog("Document", paragraphModel.DocumentId, Utils.GetUsername(Request), ActionPerformed.MODIFY);
                return(Ok("Paragraph Modified"));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
Exemple #2
0
        public void IntegrationTest_ExpectedParameters_Ok()
        {
            ParagraphDataAccess    paragraphDA = new ParagraphDataAccess();
            ParagraphBusinessLogic paragraphBL = new ParagraphBusinessLogic(paragraphDA);
            Paragraph paragraph1 = Utils.CreateParagraphForTest();
            Paragraph paragraph2 = Utils.CreateParagraphForTest();

            paragraphBL.AddParagraph(paragraph1);
            paragraphBL.AddParagraph(paragraph2);

            paragraph2.PutTextAtLast(text);
            paragraphBL.ModifyParagraph(paragraph2);

            paragraphBL.DeleteParagraph(paragraph1.Id);

            Paragraph         paragraph2Obtained = paragraphBL.GetParagraph(paragraph2.Id);
            IList <Paragraph> paragraphsObtained = paragraphBL.GetParagraphs();

            Assert.IsTrue(!paragraphsObtained.Contains(paragraph1) && paragraphsObtained.Contains(paragraph2Obtained));
        }