Ejemplo n.º 1
0
 internal static Db.Department ConvertToDatabase(Department dmn, Db.Department db)
 {
     CvrtDepartment domain = new CvrtDepartment(dmn);
     db.Name = domain.Name;
     db.Description = domain.Description;
     db.ImageUrl = domain.ImageUrl;
     return db;
 }
Ejemplo n.º 2
0
 public static Db.Category ConvertToDatabase(Category dmn, Db.Category db)
 {
     //CvrtCategory domain = new CvrtCategory(dmn);
     //db.DepartmentId = domain.DepartmentId;
     //db.Name = domain.Name;
     //db.Description = domain.Description;
     //db.ImageUrl = domain.ImageUrl;
     return db;
 }
Ejemplo n.º 3
0
 public static Db.Product ConvertToDatabase(Product dmn, Db.Product db)
 {
     CvrtProduct domain = new CvrtProduct(dmn);
     db.CategoryId = domain.CategoryId;
     db.Name = domain.Name;
     db.Description = domain.Description;
     db.ImageUrl = domain.ImageUrl;
     db.ExactPrice = domain.Price.ExactPrice;
     db.FromPrice = domain.Price.FromPrice;
     db.ToPrice = domain.Price.ToPrice;
     return db;
 }
Ejemplo n.º 4
0
        public static Dto.Department ToDto(Pst.Department domain)
        {
            if (domain == null)
            {
                return null;
            }

            return new Dto.Department()
            {
                Id = domain.Id,
                Name = domain.Name,
                Description = domain.Description,
                ImageUrl = domain.ImageUrl
            };
        }
Ejemplo n.º 5
0
        private static Price GetPrice(Db.Product db)
        {
            Price price = null;

            if (db.ExactPrice.HasValue)
            {
                price = new Price(db.ExactPrice.Value);
            }
            else if (db.FromPrice.HasValue && db.ToPrice.HasValue)
            {
                price = new Price(db.FromPrice.Value, db.ToPrice.Value);
            }

            return price;
        }
Ejemplo n.º 6
0
        public static Dto.Product ToDto(Pst.Product domain)
        {
            if (domain == null)
            {
                return null;
            }

            return new Dto.Product()
            {
                Id = domain.Id,
                Name = domain.Name,
                Description = domain.Description,
                ImageUrl = domain.ImageUrl,
                ExactPrice = domain.Price.ExactPrice,
                FromPrice = domain.Price.FromPrice,
                ToPrice = domain.Price.ToPrice,
                CategoryId = domain.CategoryId
            };
        }
Ejemplo n.º 7
0
 private static Lazy<IEnumerable<Category>> GetCategories(Db.Department department)
 {
     return new Lazy<IEnumerable<Category>>(() => department.Categories.Select(i => CvrtCategory.ToDomain(i)).ToList());
 }
Ejemplo n.º 8
0
 internal static Department ToDomain(Db.Department db)
 {
     return db == null ? null : new Department(db.Name, db.Description, db.ImageUrl, db.Id, GetCategories(db));
 }
Ejemplo n.º 9
0
 public static Product ToDomain(Db.Product db)
 {
     return CvrtProduct.ToDomain(db);
 }
Ejemplo n.º 10
0
 public static Category ToDomain(Db.Category db)
 {
     return CvrtCategory.ToDomain(db);
 }
Ejemplo n.º 11
0
 internal static Product ToDomain(Db.Product db)
 {
     return db == null ? null : new Product(db.CategoryId, db.Name, db.Description, db.ImageUrl, GetPrice(db), db.Id);
 }
Ejemplo n.º 12
0
 public static Db.Product ToDb(Product domain, Db.Product db)
 {
     return CvrtProduct.ConvertToDatabase(domain, db);
 }
Ejemplo n.º 13
0
 public static Db.Category ToDb(Category domain, Db.Category db)
 {
     return CvrtCategory.ConvertToDatabase(domain, db);
 }
Ejemplo n.º 14
0
 public static Db.Department ToDb(Department domain, Db.Department db)
 {
     return CvrtDepartment.ConvertToDatabase(domain, db);
 }
Ejemplo n.º 15
0
 internal static Category ToDomain(Db.Category db)
 {
     return db == null ? null : new Category(db.DepartmentId, db.Name, db.Description, db.ImageUrl, db.Id, GetProducts(db));
 }
Ejemplo n.º 16
0
 private static Lazy<IEnumerable<Product>> GetProducts(Db.Category category)
 {
     return new Lazy<IEnumerable<Product>>(() => category.Products.Select(i => CvrtProduct.ToDomain(i)).ToList());
 }
Ejemplo n.º 17
0
 public static Department ToDomain(Db.Department db)
 {
     return CvrtDepartment.ToDomain(db);
 }