public IHttpActionResult Put([FromUri] Guid id, [FromBody] MarginModel marginModel) { try { Utils.IsAValidToken(Request, AuthorizationBusinessLogic); marginModel.Id = id; MarginBusinessLogic.ModifyMargin(marginModel.ToEntity()); AuditLogBussinesLogic.CreateLog("Document", marginModel.DocumentId, Utils.GetUsername(Request), ActionPerformed.MODIFY); return(Ok(marginModel)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public void IntegrationTest_ExpectedParameters_Ok() { MarginDataAccess marginDA = new MarginDataAccess(); MarginBusinessLogic marginBL = new MarginBusinessLogic(marginDA); Margin margin1 = Utils.CreateMarginForTest(); Margin margin2 = Utils.CreateMarginForTest(); marginBL.AddMargin(margin1); marginBL.AddMargin(margin2); margin2.SetText(text); marginBL.ModifyMargin(margin2); marginBL.DeleteMargin(margin1.Id); Margin margin2Obtained = marginBL.GetMargin(margin2.Id); IList <Margin> marginsObtained = marginBL.GetMargins(); Assert.IsTrue(!marginsObtained.Contains(margin1) && marginsObtained.Contains(margin2Obtained)); }