(continuing) Service Layer Here is another layer that we put advanced CRUD operation in it. The service layer will make use of repository layer to operate on the database, as well as be used by the controller to process the data. Here also firstly we define the interface IRoleService: namespace Cobra.App.Infrastructure.Contracts { public interface IRoleService …
Category: LINQ
A Dependency Injection and Repository Pattern Example – I
Here is the usage of Dependency Injection and Depository Pattern in our project. We can see the layers and structure of the project and learn how to build a big project using the technologies mentioned before. Entity Framework Model Layer Firstly the EDMX model is built using entity framework database first mode in Cobra.Model project. We …
A Practice for LINQ and ASP.NET – IV
Task 3: Add CRUD (Create, Read, Update, Delete) and details for each page. Create a subpage inside student page for adding and removing enrolments. Add any necessary validations. Note: Be careful when you delete items. I use the scaffolding feature of VS to create the Add/Edit page. In the Add/Edit class page, I need two …
A Practice for LINQ and ASP.NET – III
From the last post we discussed how to get the number of classes belong to each subject. Now we should focus on getting the number of teachers belong to each subject. It’s quite similar to the previous one. //Get number of teachers belong each subject var staffCount = (from s in db.Subjects join c in db.Classes …
A Practice for LINQ and ASP.NET – II
In the last post we discussed Task Two of the exercise. There is another way that we can achieve the same result. Task 2: Subject page: show number of staffs, classes and enrollments belong to each subject Teacher page: show number of classes and subjects belong to each teacher Student page: show number of enrollments each student has enrolled …
A Practice for LINQ and ASP.NET – I
Auckland High School is a basic exercise for understanding more on LINQ and ASP.NET MVC. You can visit the site from http://www.nickyli.net/. The source code can be downloaded from GitHub. The contents of the exercise (italic) are from MVP Studio. Scenario You are going to design a database and a website based on that database for an …
A Brief Summary of LINQ
LINQ is a very powerful tool in .NET Framework especially when operating Collection or Database (CRUD). In Web Application development, we use it all the time for Database query. It’s important and we can hardly leave. Here is a brief summary of LINQ. Most of the contents are from the book MCSD Certification Toolkit (Exam 70-483). What is LINQ …