public void ViewEmprestimo() { IViewEmprestimoLayer data = new ViewEmprestimoLayer(); IList <VW_dados_emprestimo> emprestimo = data.GetAllViewEmprestimo(); var listaLivros = emprestimo.Select(c => new { DataDevolucao = c.DataDevolucao.HasValue ? c.DataDevolucao.Value.ToShortDateString() : null, DataEmprestimo = c.DataEmprestimo.HasValue ? c.DataEmprestimo.Value.ToShortDateString() : null, Livro = c.Livro, Usuario = c.Usuario, CodigoExemplar = c.Codigo_Exemplar, Editora = c.Editora }).ToList(); Assert.IsNotNull(listaLivros); }
public ActionResult GetDadosEmprestimo() { IViewEmprestimoLayer data = new ViewEmprestimoLayer(); IList <VW_dados_emprestimo> emprestimo = data.GetAllViewEmprestimo(); var listaEmprestimo = emprestimo.Select(c => new { DataDevolucao = c.DataDevolucao.HasValue ? c.DataDevolucao.Value.ToShortDateString() : null, DataEmprestimo = c.DataEmprestimo.HasValue ? c.DataEmprestimo.Value.ToShortDateString() : null, Livro = c.Livro, Usuario = c.Usuario, CodigoExemplar = c.Codigo_Exemplar, Editora = c.Editora }).ToList(); return(Json(listaEmprestimo, JsonRequestBehavior.AllowGet)); }