public bool AddNewDepartment(DepartmentAddEditModel entity) { bool result = false; using (ScheduleDataContext ctx = new ScheduleDataContext()) { Department dept = new Department(); if (entity.Description == "") { entity.Description = " "; } dept.Contact = entity.Contact; dept.Description = entity.Description; dept.EffectiveYearQuarterBegin = entity.EffectiveYearQuarterBegin; dept.EffectiveYearQuarterEnd = entity.EffectiveYearQuarterEnd; dept.Name = entity.Name; dept.UrlFriendlyName = entity.UrlName; ctx.Departments.InsertOnSubmit(dept); try { ctx.SubmitChanges(); result = true; } catch (Exception ex) { throw new Exception("Unable to add Department: " + ex.Message); } } return result; }
partial void UpdateDepartment(Department instance);
partial void DeleteDepartment(Department instance);
partial void InsertDepartment(Department instance);