Example #1
0
        public void UpdateDepartment(DepartmentModel department)
        {
            try
            {
                using (ApplicationContext db = new ApplicationContext())
                {
                    var result = db.Departments.SingleOrDefault(d => d.Id == department.Id);

                    result = department.CloneWithoutId(result);

                    db.SaveChanges();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw e;
            }
        }