protected void Button1_Click(object sender, EventArgs e)
        {
            EmployeeClass employee = new EmployeeClass();
            DeptClass     dept1    = new DeptClass();

            //if (ViewState["dept"] != null)
            //{
            //    dept1 = (Deptt)ViewState["adds"];
            //dept1.Deptname = ;
            // dept1.Deptlocation = ;
            employee.dept.Deptname     = txtDeptName.Text;
            employee.dept.Deptlocation = txtDeptLocation.Text;
            Session["Dept"]            = dept1;
            Response.Redirect("AddressPage.aspx");
        }
Exemple #2
0
        public ActionResult CreateDeptClass(FormCollection form)
        {
            using (var context1 = new ApplicationDbContext()){
                var data = new DeptClass()
                {
                    CreatedBy   = (string)User.Identity.GetUserId(),
                    CreatedOn   = DateTime.Now,
                    ModifiedOn  = DateTime.Now,
                    Name        = "New class",
                    Description = "new Description"
                };
                DeptRepo deptRepo = new DeptRepo(context1);
                deptRepo.Add(data);
            }



            return(Redirect("/Admin/Index"));
        }
Exemple #3
0
 public void Add(DeptClass emp)
 {
     _context.DeptClasses.Add(emp);
     _context.SaveChanges();
 }