Inheritance: DomainObject
Ejemplo n.º 1
0
        private PartnerWithCategorysViewModel ConvertFromPartnerToPartnerWithCategorysViewModel(Partner partner)
        {
            PartnerWithCategorysViewModel partnerWithCategorys = new PartnerWithCategorysViewModel();
            partnerWithCategorys.Categorys = new List<CategoryViewModel>();

            foreach (Category c in partner.Categories)
            {
                partnerWithCategorys.Categorys.Add(ConvertFromCategoryToCategoryViewModel(c));
            }

            partnerWithCategorys.Id = partner.PartnerId;
            partnerWithCategorys.Name = partner.Name;
            partnerWithCategorys.CreatedDate = partner.CreatedDate;
            partnerWithCategorys.UpdatedDate = partner.UpdatedDate;
            partnerWithCategorys.UserId = partner.UserId ?? null;
            partnerWithCategorys.Address = partner.Address;
            partnerWithCategorys.Phone = partner.Phone;
            partnerWithCategorys.Email = partner.Email;
            partnerWithCategorys.Contact = partner.Contact;

            return partnerWithCategorys;
        }
Ejemplo n.º 2
0
        private PartnerWithAllCategorysViewModel ConvertFromPartnerToPartnerWithAllCategorysViewModel(Partner c)
        {
            PartnerWithCategorysViewModel partnerWithCategorys = ConvertFromPartnerToPartnerWithCategorysViewModel(c);
            PartnerWithAllCategorysViewModel partnerWithAllCategorys = new PartnerWithAllCategorysViewModel();

            partnerWithAllCategorys.Categorys = partnerWithCategorys.Categorys;
            partnerWithAllCategorys.Id = partnerWithCategorys.Id;
            partnerWithAllCategorys.Name = partnerWithCategorys.Name;
            partnerWithAllCategorys.CreatedDate = partnerWithCategorys.CreatedDate;
            partnerWithAllCategorys.UpdatedDate = partnerWithCategorys.UpdatedDate;
            partnerWithAllCategorys.UserId = partnerWithCategorys.UserId ?? null;
            partnerWithAllCategorys.Address = partnerWithCategorys.Address;
            partnerWithAllCategorys.Phone = partnerWithCategorys.Phone;
            partnerWithAllCategorys.Email = partnerWithCategorys.Email;
            partnerWithAllCategorys.Contact = partnerWithCategorys.Contact;

            var categorysList = categoryRepository.Get().Select(ConvertFromCategoryToCategoryViewModel);
            partnerWithAllCategorys.AllCategorys = categorysList.ToList();

            return partnerWithAllCategorys;
        }