Posts

MVC

Image
MVC Request Life Cycle WebBrowser >> IIS >> UrlRoutingModule (HttpModule) >> RouteData (Controller/Action) >> RequestContext >> MVCRouteHandler (HttpHandler) >> MVCHandler >> IControllerFactory >> ActionResult Any web application has two main execution steps, first understanding the request and depending on the type of the request sending out appropriate response. MVC application life cycle is not different it has two main phases, first creating the request object and second sending our response to the browser. Creating the request object:  The request object creation has four major steps. The following is the detailed explanation of the same. Step 1: Fill route MVC requests are mapped to route tables which in turn specify which controller and action to be invoked. So if the request is the first request the first thing is to fill the route table with routes collection. This filling of route table happens in the global.asax f

Xamarin

Xamarin

WEB API

WEB API public class CustomerController : ApiController {     private OrderMgmtEntities db = new OrderMgmtEntities ();     // GET api/Customer     public IEnumerable < Customer > GetCustomers()     {         return db.Customers.AsEnumerable();     }     // GET api/Customer/5     public Customer GetCustomer( int id)     {         Customer customer = db.Customers.Find(id);         if (customer == null )         {             throw new HttpResponseException (Request.CreateResponse( HttpStatusCode .NotFound));         }         return customer;     }     // PUT api/Customer/5     public HttpResponseMessage PutCustomer( int id, Customer customer)     {         if (ModelState.IsValid && id == customer.CustomerId)         {             db.Entry(customer).State = EntityState .Modified;             try             {                 db.SaveChanges();             }             catch ( DbUpda