This application is a basic CRUD application, which maintain the Contact CRUD operations. The application is made up of MVC and WEB API 2 under the same project. The main idea of creating the MVC and WEB API is that: MVC acted as a client and WEB API acted as a server in which MVC client make a call to the MVC Controller which calls the API controller and API handle the request accordingly. MVC Clinnt is a simple Scaffolding application, didn't have much changes. The main focus is to the WEB API side.
#Application Environments
Application Developed in:
Visual studio 2015.
.Net framework 4.6
MVC 5
Web API 2
SQL 2016
To run the application
- Provide initialCatalog and baseApiPath in web.config application Setting.
- Provide your connectionString settings in web.config file.
MVC 5 : Acted as a client.
Web API 2 : Acted as a server.
Unity 5 : IOC for Dependency injection.
LogWriter : custom class which log the exception in the .txt file date wise.Very basic(only the concept of exception handling is covered).
EntityFramework 6 : ORM.
Factory Method pattern: used to create a context according to the initialCatalog provid.
Unit test cases: Could not get time to write(I can write if time provided.).
PhoneNumber should be provide in a proper format(10 digit), otherwie error thrown and redirected to the error page.
- Get the list of Contacts(all contacts: no filter with inactive or acctive).
- Add contact.
- Edit contact.
- Delete(Activate/Deactivate) only soft deletethe contact.
The issue is because of enabled of entity-framework code first migration enabled.So that for the first time the table Contacts in created by its own(initialize the database and entity), if some entity property changes make then the above issue persists.
if the below issue occours:
#The model backing the context has changed since the database was created.
then please uncomment the code.
//protected override void OnModelCreating(DbModelBuilder modelBuilder)
//{
// Database.SetInitializer<ContactContext>(null);
// base.OnModelCreating(modelBuilder);
//}<br/>
lies in the path: CMS/CMSApp/CMSApp/Models/DataAccessLayer/ContactContext.cs.