Book Image

Learning NHibernate 4

Book Image

Learning NHibernate 4

Overview of this book

Table of Contents (18 chapters)
Learning NHibernate 4
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Feature 1 – onboarding an employee


In our problem statement, we did not clearly define what happens when a new employee joins. We would detail that out now so that we have something meaningful to work with. Let's say, the following needs to happen when a new employee joins:

  • Employee is awarded 21 sick leaves and 24 paid leaves

  • A skill enhancement allowance of £1,000 is allocated

  • Employee record is saved in database

First two items are clearly a part of business logic. We can say that this logic can live within the Employee class. Third item is not a domain concern but more of an infrastructure concern. So we would want to push it out to one of the outer layers of onion architecture. It is difficult to say which layer this items belongs to exactly. So instead of trying to answer that question now, let's work with what we have got and see where that takes us.

First of all, we would need a controller and an action defined on the controller that accepts a POST request for onboarding a new employee...