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; }
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; }
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; }
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 }; }
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; }
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 }; }
private static Lazy<IEnumerable<Category>> GetCategories(Db.Department department) { return new Lazy<IEnumerable<Category>>(() => department.Categories.Select(i => CvrtCategory.ToDomain(i)).ToList()); }
internal static Department ToDomain(Db.Department db) { return db == null ? null : new Department(db.Name, db.Description, db.ImageUrl, db.Id, GetCategories(db)); }
public static Product ToDomain(Db.Product db) { return CvrtProduct.ToDomain(db); }
public static Category ToDomain(Db.Category db) { return CvrtCategory.ToDomain(db); }
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); }
public static Db.Product ToDb(Product domain, Db.Product db) { return CvrtProduct.ConvertToDatabase(domain, db); }
public static Db.Category ToDb(Category domain, Db.Category db) { return CvrtCategory.ConvertToDatabase(domain, db); }
public static Db.Department ToDb(Department domain, Db.Department db) { return CvrtDepartment.ConvertToDatabase(domain, db); }
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)); }
private static Lazy<IEnumerable<Product>> GetProducts(Db.Category category) { return new Lazy<IEnumerable<Product>>(() => category.Products.Select(i => CvrtProduct.ToDomain(i)).ToList()); }
public static Department ToDomain(Db.Department db) { return CvrtDepartment.ToDomain(db); }