Exemple #1
0
 private IList <VendorViewModel> GetVendors(IList <Vendor> vendors)
 {
     return(vendors.Select(x => new VendorViewModel
     {
         Id = x.Id,
         Name = x.Name,
         Address = x.Address,
         PhoneNumber = x.PhoneNumber,
         CreateDate = x.CreatedDate,
         UpdateDate = x.UpdatedDate,
         Products = ConvertDomainToModel.GetProduct_SummaryInfo(_productService.GetProductsByVendorId(x.Id)),
         IsActive = x.IsActive
     }).ToList());
 }
 private IList <BrandViewModel> GetBrands(IList <Brand> brands)
 {
     return(brands.Select(x => new BrandViewModel
     {
         Id = x.Id,
         Name = x.Name,
         Summary = x.Summary,
         Logo = x.Logo,
         CreateDate = x.CreatedDate,
         UpdateDate = x.UpdatedDate,
         Products = ConvertDomainToModel.GetProduct_SummaryInfo(_productService.GetProductsByBrandId(x.Id)),
         IsActive = x.IsActive
     }).ToList());
 }
        /// <summary>
        /// Detail Brand
        /// </summary>
        /// <param name="id"></param>
        /// <returns>Detail View</returns>
        public ActionResult DetailBrand(Guid id)
        {
            var brand = _brandService.GetById(id);
            var model = new BrandViewModel
            {
                Id         = brand.Id,
                Name       = brand.Name,
                Logo       = brand.Logo,
                CreateDate = brand.CreatedDate,
                IsActive   = brand.IsActive,
                Summary    = brand.Summary,
                Products   = ConvertDomainToModel.GetProduct_SummaryInfo(_productService.GetProductsByBrandId(brand.Id)),
                UpdateDate = brand.UpdatedDate,
            };

            return(View(model));
        }
        /// <summary>
        /// Detail Brand
        /// </summary>
        /// <param name="id"></param>
        /// <returns>Detail View</returns>
        public ActionResult DetailVendor(Guid id)
        {
            var vendor = _vendorService.GetById(id);
            var model  = new VendorViewModel
            {
                Id          = vendor.Id,
                Name        = vendor.Name,
                Address     = vendor.Address,
                CreateDate  = vendor.CreatedDate,
                IsActive    = vendor.IsActive,
                Email       = vendor.Email,
                PhoneNumber = vendor.PhoneNumber,
                Products    = ConvertDomainToModel.GetProduct_SummaryInfo(_productService.GetProductsByVendorId(vendor.Id)),
                UpdateDate  = vendor.UpdatedDate,
            };

            return(View(model));
        }