public CertificationMark UpdateCertificationMark(CertificationMark updatedCertificationMark)
        {
            var certificationMarkToUpdate =
                _certificationMarkRepository.FindOne(x => x.Id == updatedCertificationMark.Id);
            certificationMarkToUpdate.CopyStringProperties(updatedCertificationMark);
            _certificationMarkRepository.Persist();

            return certificationMarkToUpdate;
        }
예제 #2
0
        public void RemoveCertificationMark(CertificationMark certificationMark)
        {
            var productCertificationMarks =
                _entitySetProductCertificationMarks.Where(x => x.CertificationMark == certificationMark);

            if (productCertificationMarks.Count() != 0)
            {
                _entitySetProductCertificationMarks.Remove(productCertificationMarks.First());
            }
        }
        public CertificationMark CreateCertificationMark(Mentor certifier, CertificationMark certificationMarkToCreate)
        {
            var newCertificationMark = new CertificationMark();
            newCertificationMark.CopyStringProperties(certificationMarkToCreate);
            SetCertifier(newCertificationMark, certifier);

            _certificationMarkRepository.Add(newCertificationMark);
            _certificationMarkRepository.Persist();

            return newCertificationMark;
        }
 public static CertificationMark BuildCertificationMark(Mentor mentor)
 {
     var certificationMark = new CertificationMark
     {
         CertificationMarkImageUrlLarge = "",
         CertificationMarkImageUrlMedium = "",
         CertificationMarkImageUrlSmall = "",
         Gs1Code = "",
         CertificationName = "Krav",
         Certifier = mentor
     };
     return certificationMark;
 }
        public ActionResult CreateCertificationMark(CertificationMark certificationMarkToCreate)
        {
            try
            {
                _certificationMarkDomainService.CreateCertificationMark(CurrentMentor, certificationMarkToCreate);

                return RedirectToAction("Index");
            }
            catch(Exception exception)
            {
                return View();
            }
        }
        public ActionResult EditCertificationMark(CertificationMark updatedCertificationMark, FormCollection collection)
        {
            try
            {
                _certificationMarkDomainService.UpdateCertificationMark(updatedCertificationMark);
 
                return RedirectToAction("Index");
            }
            catch
            {
                var certificationMark = _certificationMarkDomainService.GetCertificationMarkById(updatedCertificationMark.Id);
                return View(certificationMark);
            }
        }
예제 #7
0
 public void AddCertificationMark(CertificationMark certificationMark)
 {
     if (_entitySetProductCertificationMarks.Where(x => x.CertificationMark == certificationMark).Count() != 0)
     {
         return;
     }
     _entitySetProductCertificationMarks.Add(new ProductCertificationMark
     {
         Product             = this,
         ProductId           = Id,
         CertificationMark   = certificationMark,
         CertificationMarkId = certificationMark.Id
     });
 }
        protected override void Before_all_specs()
        {
            SetupDatabase(ShopGunSpecBase.Database.ShopGun, typeof(Base).Assembly);

            _productRepository = new ProductRepository(GetNewDataContext());
            _productApplicationService = new ProductApplicationService(null, null, null, null, null);

            _brand = BrandBuilder.BuildBrand();
            using (var brandRepository = new Repository<Brand>(GetNewDataContext()))
            {
                brandRepository.Add(_brand);
                brandRepository.Persist();
            }

            _country = CountryBuilder.BuildCountry();
            using (var countryRepository = new Repository<Country>(GetNewDataContext()))
            {
                countryRepository.Add(_country);
                countryRepository.Persist();
            }

            _mentor = MentorBuilder.BuildMentor();
            _certificationMark = CertificationMarkBuilder.BuildCertificationMark(_mentor);
            using (var certificationMarkRepository = new Repository<CertificationMark>(GetNewDataContext()))
            {
                certificationMarkRepository.Add(_certificationMark);
                certificationMarkRepository.Persist();
            }

            _ingredient = IngredientBuilder.BuildIngredient();
            using (var ingredientRepository = new Repository<Ingredient>(GetNewDataContext()))
            {
                ingredientRepository.Add(_ingredient);
                ingredientRepository.Persist();
            }
        }
 public void DeleteCertificationMark(CertificationMark certificationMarkToDelete)
 {
     certificationMarkToDelete = _certificationMarkRepository.FindOne(x => x.Id == certificationMarkToDelete.Id);
     _certificationMarkRepository.Delete(certificationMarkToDelete);
     _certificationMarkRepository.Persist();
 }
 private void SetCertifier(CertificationMark newCertificationMark, Mentor certifier)
 {
     var certififer = _certificationMarkRepository.FindDomainObject(certifier);
     newCertificationMark.Certifier = certififer;
 }