Implementing the business logic layer

Now that we have the data access layer ready, we can modify the business logic layer to call this layer.

  1. Add a new class file called ProductLogic.cs.
  2. Change the ProductLogic class to be a public class.
  3. Define the productDAL variable as a class member, like this:
    ProductDAL productDAL = new ProductDAL();
    
  4. Add the GetProduct method as follows:
public ProductEntity GetProduct(int id)
{
return productDAL.GetProduct(id);
}
Add UpdateProduct method like this:
public bool UpdateProduct(ProductEntity productEntity)
{
return productDAL.UpdateProduct(productEntity);
}

This class is very similar to the business logic class in the previous chapters, except that in the previous chapters this project references the BusinessEntities project, whereas here it only references the data access project. As we said earlier, this is because the product entity is now embedded inside the data access project LINQ to SQL designer class file, instead of being in a separate BusinessEntities project.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset