示例#1
0
        public void TestClone()
        {
            var b = brand.Clone();

            foreach (var property in b.GetType().GetProperties())
            {
                Assert.AreEqual(property.GetValue(brand), property.GetValue(b));
            }
        }
示例#2
0
        public string CreateBrand(Brand brand)
        {
            CheckHelper.ArgumentNotNull(brand, "brand");
            CheckHelper.WithinCondition(SecurityService.IsLoggedIn, "SecurityService.IsLoggedIn");

            var errors = IoC.Container.Get <IValidateService>().Validate(brand);

            if (errors != null)
            {
                return(errors.ToErrorMessage());
            }

            var createdBrand = (Brand)brand.Clone();

            var errorMessage = APIClientHelper <DictionaryAPIClient> .Call(c => c.CreateBrand(ref createdBrand));

            brand.Id = createdBrand.Id;

            return(errorMessage);
        }