/// <summary> /// Converts this instance of <see cref="SanPhamDTO"/> to an instance of <see cref="SanPham"/>. /// </summary> /// <param name="dto"><see cref="SanPhamDTO"/> to convert.</param> public static SanPham ToEntity(this SanPhamDTO dto) { if (dto == null) { return(null); } var entity = new SanPham(); entity.MaLoai = dto.MaLoai; entity.MaSP = dto.MaSP; entity.TenSP = dto.TenSP; entity.MoTa = dto.MoTa; entity.HinhAnh1 = dto.HinhAnh1; entity.HinhAnh2 = dto.HinhAnh2; entity.HinhAnh3 = dto.HinhAnh3; entity.HinhAnh4 = dto.HinhAnh4; entity.SoLuong = dto.SoLuong; entity.MaNCC = dto.MaNCC; entity.GiaVon = dto.GiaVon; dto.OnEntity(entity); return(entity); }
/// <summary> /// Converts this instance of <see cref="SanPham"/> to an instance of <see cref="SanPhamDTO"/>. /// </summary> /// <param name="entity"><see cref="SanPham"/> to convert.</param> public static SanPhamDTO ToDTO(this SanPham entity) { if (entity == null) { return(null); } var dto = new SanPhamDTO(); dto.MaLoai = entity.MaLoai; dto.MaSP = entity.MaSP; dto.TenSP = entity.TenSP; dto.MoTa = entity.MoTa; dto.HinhAnh1 = entity.HinhAnh1; dto.HinhAnh2 = entity.HinhAnh2; dto.HinhAnh3 = entity.HinhAnh3; dto.HinhAnh4 = entity.HinhAnh4; dto.SoLuong = entity.SoLuong; dto.MaNCC = entity.MaNCC; dto.GiaVon = entity.GiaVon; entity.OnDTO(dto); return(dto); }
/// <summary> /// Invoked when <see cref="ToEntity"/> operation is about to return. /// </summary> /// <param name="entity"><see cref="SanPham"/> converted from <see cref="SanPhamDTO"/>.</param> static partial void OnEntity(this SanPhamDTO dto, SanPham entity);
/// <summary> /// Invoked when <see cref="ToDTO"/> operation is about to return. /// </summary> /// <param name="dto"><see cref="SanPhamDTO"/> converted from <see cref="SanPham"/>.</param> static partial void OnDTO(this SanPham entity, SanPhamDTO dto);