public async Task <ArticleModelEngine> GetLastAsunc() { try { var dbArtikle = await ArtikleDA.GetLastAsunc(); var article = Mapper.Map <ArticleModelEngine>(dbArtikle); return(await Task.FromResult(article)); } catch (Exception ex) { Logger.Error($"Error:{ex.ToString()}"); return(null); } }
public async Task <List <ArticleModelEngine> > GetAllAsync(int skipCount, int takeCount) { try { //проверка доступности для пользователя var dbArtikles = await ArtikleDA.GetAllAsync(skipCount, takeCount); var articles = Mapper.Map <List <ArticleModelEngine> >(dbArtikles); return(await Task.FromResult(articles)); } catch (Exception ex) { Logger.Error($"Error:{ex.ToString()}"); return(null); } }
public async Task <IResultEngine> UpdateAsync(ArticleModelEngine article) { try { Logger.Information($"Method:{MethodBase.GetCurrentMethod().DeclaringType.FullName} Parametrs:article={article?.Name}"); var dbArtikle = Mapper.Map <Articles>(article); var res = await ArtikleDA.UpdateAsync(dbArtikle); var result = Mapper.Map <IResultEngine>(res); return(await Task.FromResult(result)); } catch (Exception ex) { Logger.Error($"Error:{ex.ToString()}"); return(await Task.FromResult(ResultEngine.Fail())); } }