예제 #1
0
        private void AddNewClaim()
        {
            if (_resVm == null)
            {
                Assert.Fail("AddNewClaim: Test Failed to create a new manager.");
            }

            var dbRes = ManagerSvc.AddClaim(_resVm.Id, "/sample/claim");

            _resClaimVm = dbRes.Claim;
            Assert.IsTrue(dbRes.IsSuccess);
        }
예제 #2
0
        /// <summary>
        /// Update an existing resource claim
        /// </summary>
        /// <param name="claim">Resource Claim</param>
        /// <returns><![CDATA[ (ResourceClaimVm Claim, bool IsSuccess, String Message) ]]></returns>
        public (ResourceClaimVm Claim, bool IsSuccess, String Message) UpdateClaim(ResourceClaimVm claim)
        {
            // Check and make sure that the data exisits.
            var dbClaim = ResourceDataAccess.ResourceClaim.GetById(claim.Id);

            if (dbClaim == null)
            {
                return(null, false, ResourceManagerMessages.Error.RESOURCE_NOT_FOUND);
            }

            // Update the resource manager.
            dbClaim = claim.ToEntity(dbClaim);
            ResourceDataAccess.ResourceClaim.Update(dbClaim);
            ResourceDataAccess.Save();

            claim = new ResourceClaimVm(dbClaim);
            return(claim, true, ResourceManagerMessages.Success.RESOUCE_UPDATED);
        }