Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         var deptId = Convert.ToInt32(Request.QueryString["id"]);
         DepartmentService         service = new DepartmentService();
         Contoso.Model.Departments dept    = service.GetById(deptId);
         lbDeptName.Text = dept.Name;
         lbBudget.Text   = dept.Budget.ToString();
     }
 }
Esempio n. 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Contoso.Model.Departments dept = new Contoso.Model.Departments
            {
                Name         = txtName.Text,
                Budget       = Convert.ToInt32(txtBudget.Text),
                StartDate    = Convert.ToDateTime(txtStartDate.Text),
                InstructorId = Convert.ToInt32(txtInstructorId.Text)
            };
            DepartmentService service = new DepartmentService();

            service.SaveDepartment(dept);
        }