Skip to main content

Posts

Showing posts from January, 2015

Simple MVC project

MODELS



[1] CREATE USER MODEL
-----------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace _1___kushan.Models
{
public class User
{
public int ID { get; set; }
public string Name { get; set; }
}
}

[2] CREATE DB CONTEXT
---------------------

namespace _1___kushan.Models
{
public class Context : DbContext
{
public DbSet<Models.User> Users { get; set; }
}
}

CONTROLLER



[3] CREATE CONTROLLER
---------------------

using _1___kushan.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace _1___kushan.Controllers
{
public class UserController : Controller
{
//
// GET: /User/

public ActionResult Index()
{

return View();
}

//RESPONSE FOR SIMPLE BUTTON CLICK
[HttpPost]
public ActionResult Index(Models.User user)
{
Context con = new Context();//object with context
User u = new User//user model
{
Name = user.Name
};
con.Users.Add(u);//adding
con.SaveChanges();//writes to DB
return View();
}

}
}

VIEW



[4] GENERATE THE VIEW…

SOAP ( Simple Object Access Protocol ) - Introduction

WHAT?
~~~~~~~~~~~~~~~~
SOAP provides a way to communicate between applications running on different operating systems,
with different technologies and programming languages.

stands for Simple Object Access Protocol
a communication protocol
communication between applications
format for sending messages
communicates via Internet
platform & language independent
based on XML

Syntax Rules
~~~~~~~~~~~~~~~~
Here are some important syntax rules:
A SOAP message MUST be encoded using XML
A SOAP message MUST use the SOAP Envelope namespace
A SOAP message MUST use the SOAP Encoding namespace
A SOAP message must NOT contain a DTD reference
A SOAP message must NOT contain XML Processing Instructions

Example:
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Header>
...
</soap:Header>

<soap:Body>
...
<soap:Fault>
...
</soap:Fault>
</soap:Body>

&…