コード例 #1
0
        public void Add(Dpartment dept)
        {
            var addDept = context.Departments
                          .Add(dept);

            context.SaveChanges();
        }
コード例 #2
0
        public void UpdateDepartment(Dpartment dept)
        {
            var update = context.Departments.Find(dept.ID);

            update.DeptName = dept.DeptName;
            update.Location = dept.Location;
            context.SaveChanges();
        }
コード例 #3
0
        public void EditDepartment(EditViewModel evm)
        {
            Dpartment department = new Dpartment
            {
                ID = evm.Id, DeptName = evm.DeptName, Location = evm.Location
            };

            _repo.UpdateDepartment(department);
        }
コード例 #4
0
        public void AddDept(AddViewModel avm)
        {
            Dpartment department = new Dpartment {
                DeptName = avm.DeptName, Location = avm.Location
            };

            //   department.ID = avm.ID;
            _repo.Add(department);
        }