Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TestController : ApiController
- {
- [HttpGet]
- public IEnumerable<Test> GetTests()
- {
- using(var context = new DatabaseContext())
- {
- return context.Tests.Where(w=>w.Enabled).ToList();
- }
- }
- }
- try
- {
- using (var context = new DatabaseContext())
- {
- return context.Tests.Where(w=>w.Enabled).ToList();
- }
- }
- catch(Exception e)
- {
- // TODO: handle also those ValidationErrors, thrown by Entity Framework
- // so here we get a lot more code
- _logger.Error(e);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement