public List <UiBlog> GetAll() { List <Blog> blogs = _blogDal.GetList(); List <Category> categorys = _categoryDal.GetList(); List <Author> authors = _authorDal.GetList(); List <UiBlog> uiBlogs = new List <UiBlog>(); foreach (var item in blogs) { Category category = categorys.Find(c => c.id == item.categoryid); UiBlog uiBlog = new UiBlog { title = item.title, description = item.description, category = category.name, postcolor = category.postcolor, author = authors.Find(a => a.id == item.authorId).name, }; uiBlogs.Add(uiBlog); } return(uiBlogs); }
public IActionResult Index() { Log log = new Log { Audit = "INFO", Date = DateTime.Now, Detail = "Home.Index()", User = User.Identity.IsAuthenticated ? User.Identity.Name : ConstStrings.Anonymous, Ip = HttpContext.Connection.RemoteIpAddress.ToString() }; _logDal.Add(log); var blogs = _blogDal.GetList(); return(View(blogs)); }
public List <Blog> GetList(Expression <Func <Blog, bool> > filter = null, params string[] includeList) { try { return(blogDal.GetList(filter, includeList)); } catch (Exception ex) { throw ex; } }
public DataResponse GetList() { var blog = _blogDal.GetList(); if (blog == null) { return new DataResponse { Mesaj = "Aradiginiz Bloglar Getirilemedi", Tamamlandi = false } } ; return(new DataResponse { Data = blog, Mesaj = "Bloglar Getirildi", Tamamlandi = true }); }
public EntityResult <List <Blog> > GetList(Expression <Func <Blog, bool> > filter = null, params string[] includeList) { try { List <Blog> blogs = _blogDal.GetList(filter, includeList); if (blogs != null) { return(new EntityResult <List <Blog> >(blogs, "Başarılı", ResultState.Success)); } else { return(new EntityResult <List <Blog> >(null, "Hata Oluştu", ResultState.Warning)); } } catch (Exception ex) { return(new EntityResult <List <Blog> >(null, "Database Hatasıı " + ex.ToInnestException().Message, ResultState.Error)); } }
public List <Blog> GetList() { return(_blogDal.GetList()); }
public List <Blog> GetById(int id) { return(_blogDal.GetList(b => b.Id == id).ToList()); }