/// <summary> /// Receives a product and set each field in ProductAdministrationModel /// </summary> /// <param name="product"></param> public ProductModel(auRant.Core.Entities.Product product) { this.ID = product.ID; this.Name = product.Name; this.CategoryId = product.Category.ID; this.Price = product.Price; this.CategoryName = product.Category.Name; this.StatusId = product.PublicationStatus.ID; this.StatusName = product.PublicationStatus.Name; this.supplierId = product.Supplier.ID; this.supplierName = product.Supplier.Name; this.urlImage = string.Concat(urlFolderImage, product.urlImage); this.ShortDescription = product.ShortDescription; this.FullDescription = product.FullDescription; }
/// <summary> /// Update a product's fields with this fields values /// </summary> /// <returns></returns> public void UpdateProduct(auRant.Core.Entities.Product produtoEditavel, ProductCategory category, PublicationStatus productStatus, Supplier supplier) { produtoEditavel.Name = this.Name; produtoEditavel.Category = category; produtoEditavel.PublicationStatus = productStatus; produtoEditavel.Price = this.Price; produtoEditavel.Supplier = supplier; produtoEditavel.urlImage = this.urlImage; produtoEditavel.ShortDescription = this.ShortDescription; produtoEditavel.FullDescription = this.FullDescription; }