/// <summary> /// Converts this instance of <see cref="NguoiDung"/> to an instance of <see cref="NguoiDungDTO"/>. /// </summary> /// <param name="entity"><see cref="NguoiDung"/> to convert.</param> public static NguoiDungDTO ToDTO(this NguoiDung entity) { if (entity == null) { return(null); } var dto = new NguoiDungDTO(); dto.Username = entity.Username; dto.Password = entity.Password; dto.Role = entity.Role; entity.OnDTO(dto); return(dto); }
/// <summary> /// Converts this instance of <see cref="NguoiDungDTO"/> to an instance of <see cref="NguoiDung"/>. /// </summary> /// <param name="dto"><see cref="NguoiDungDTO"/> to convert.</param> public static NguoiDung ToEntity(this NguoiDungDTO dto) { if (dto == null) { return(null); } var entity = new NguoiDung(); entity.Username = dto.Username; entity.Password = dto.Password; entity.Role = dto.Role; dto.OnEntity(entity); return(entity); }
/// <summary> /// Invoked when <see cref="ToEntity"/> operation is about to return. /// </summary> /// <param name="entity"><see cref="NguoiDung"/> converted from <see cref="NguoiDungDTO"/>.</param> static partial void OnEntity(this NguoiDungDTO dto, NguoiDung entity);
/// <summary> /// Invoked when <see cref="ToDTO"/> operation is about to return. /// </summary> /// <param name="dto"><see cref="NguoiDungDTO"/> converted from <see cref="NguoiDung"/>.</param> static partial void OnDTO(this NguoiDung entity, NguoiDungDTO dto);