| using System;
|
| 1:using System.Data;
|
| 2:using System.Configuration;
|
| 3:using System.Linq;
|
| 4:using System.Web;
|
| 5:using System.Web.Security;
|
| 6:using System.Web.UI;
|
| 7:using System.Web.UI.HtmlControls;
|
| 8:using System.Web.UI.WebControls;
|
| 9:using System.Web.UI.WebControls.WebParts;
|
| 10:using System.Xml.Linq;
|
| 11:
|
| 12:namespace MVCImplementation
|
| 13:{
|
| 14: public partial class MVCSample : System.Web.UI.Page, MVC.View.IEmployeeView
|
| 15: {
|
| 16: MVC.Controller.IEmployeeController _controller;
|
| 17:
|
| 18: protected void Page_Load(object sender, EventArgs e)
|
| 19: {
|
| 20: _controller = new MVC.Controller.EmployeeController(this);
|
| 21: }
|
| 22:
|
| 23:
|
| 24:
|
| 25:
|
| 26: #region IEmployeeView Members
|
| 27:
|
| 28: public Employee GetEmployee()
|
| 29: {
|
| 30: throw new NotImplementedException();
|
| 31: }
|
| 32:
|
| 33:
|
| 34:
|
| 35: public void AddEmployee()
|
| 36: {
|
| 37: BusinessEntities.Employee emp = new Employee();
|
| 38: emp.Name = txtName.Text;
|
| 39: emp.Address = txtAddress.Text;
|
| 40: emp.Email = txtEmail.Text;
|
| 41:
|
| 42: this._controller.AddEmployee(emp);
|
| 43: }
|
| 44:
|
| 45:
|
| 46: #endregion
|
| 47:
|
| 48: protected void btnAdd_Click(object sender, EventArgs e)
|
| 49: {
|
| 50: AddEmployee();
|
| 51: }
|
| 52:
|
| 53: protected void btnGetDetails_Click(object sender, EventArgs e)
|
| 54: {
|
| 55: gvDetails.DataSource = this._controller.GetEmployees();
|
| 56: gvDetails.DataBind();
|
| 57: }
|
| 58: }
|
| 59:}
|
| 60: |