public async Task <PageHomepageViewModel> GetPageByIdAsync(int pageId) { PageHomepageViewModel result = null; string cmd = $@"SELECT * FROM `page` f LEFT JOIN `page_language` fl ON f.id = fl.page_id WHERE f.is_deleted = 0 and f.id = {pageId}"; if (DbConnection != null) { var rd = await DbConnection.QueryMultipleAsync(cmd, transaction : DbTransaction); rd.Read <Page, PageLanguage, PageHomepageViewModel>( (fRs, flRs) => { if (result == null) { result = CommonHelper.Mapper <Page, PageHomepageViewModel>(fRs); } if (flRs != null) { result.PageLanguages.Add(flRs); } return(result); } ); return(result); } else { using (var conn = DALHelper.GetConnection()) { var rd = await conn.QueryMultipleAsync(cmd); rd.Read <Page, PageLanguage, PageHomepageViewModel>( (fRs, flRs) => { if (result == null) { result = CommonHelper.Mapper <Page, PageHomepageViewModel>(fRs); } if (flRs != null) { result.PageLanguages.Add(flRs); } return(result); } ); return(result); } } }
public UpdateCommand(PageHomepageViewModel page) { this.Page = page; }
public AddCommand(PageHomepageViewModel page) { this.Page = page; }