public async Task <Models.PictureModelEngine> GetLastAsunc() { try { var dbArtikles = await PictureDA.GetLastAsunc(); var article = Mapper.Map <PictureModelEngine>(dbArtikles); return(await Task.FromResult(article)); } catch (Exception ex) { Logger.Error($"Error:{ex.ToString()}"); return(null); } }
public async Task <List <Models.PictureModelEngine> > GetAllAsync(int skipCount, int takeCount) { try { var dbArtikles = await PictureDA.GetAllAsync(skipCount, takeCount); var articles = Mapper.Map <List <PictureModelEngine> >(dbArtikles); return(await Task.FromResult(articles)); } catch (Exception ex) { Logger.Error($"Error:{ex.ToString()}"); return(null); } }
public async Task <IResultEngine> AddAsync(Models.PictureModelEngine picture) { try { Logger.Information($"Method:{MethodBase.GetCurrentMethod().DeclaringType.FullName} Parametrs:article={picture?.Id}"); var dbArtikle = Mapper.Map <Pictures>(picture); var res = await PictureDA.AddAsync(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())); } }