Please enable JavaScript.
Coggle requires JavaScript to display documents.
ASP.Net MVC Full stack development v3 (Refactoring to an OO design (Object…
ASP.Net MVC Full stack development v3
Implement edit/update operation
Using Expressions to replace magic string -
(Id != 0) ? "Update" : "Create";
Implement Cancel operation -
API and JQuery Ajax
Dialogs - Bootbox.min.js
(include in BundleConfig)
Exclude logically deleted items from view
15 Avoid pitfalls in Domain Models
Avoid inheritance and use composition instead -
http://bit.ly/oop-inheritance
Refactoring to an OO design
Anaemic domain model - classes with only properties -
good for apps with little business logic
Object should be in a valid state
Fill props with constructor - guard clauses(null, etc)
Using private acces modifiers
Rich bussines logic - move it from controllers to domain classes (FAT controllers and API-s)
Cohesion - thing that are highly reated should be together
(separate them in a method if possible)
Use factory methods to create objects - responsible to create objects in a valid state
Set constructor to private
Create static factory methods that return constructors of a current class
Mapping Domain
Objects to DTO-s
APIs should return DTO-s (they don't return all properties (sensitive data) of a Domain Model to the client)
Map using AutoMapper - cleaner mapping code
Bootstrap Icons,
Badges and Popovers
Use Underscore.js - javascript templating engine (like Razor in ASP:Net MVC)
Use LESS to write cleaner CSS
Handling Bootstrap events
Implementing search action
Define a query string shown in url so the page is bookmarkable