예제 #1
0
        public void Update(JobTitleCate model)
        {
            var entity = Find(model.ID);
            db.Attach<JobTitleCate>(entity);
            entity.CateName = model.CateName;
            entity.PID = model.PID;
            entity.Code = model.Code;
            entity.Level = model.Level;
            entity.OrderIndex = model.OrderIndex;

            db.Commit();
        }
예제 #2
0
        public JobTitleCate Create(JobTitleCateViewModel model)
        {
            var entity = new JobTitleCate();
            entity.CateName = model.CateName;
            entity.PID = model.PID;
            entity.Code = model.Code;
            entity.Level = model.Level;
            entity.OrderIndex = model.OrderIndex;

            var departArray = model.DepartmentID.Split(',').Select(x => Convert.ToInt32(x)).ToList();
            var DepartmentList = DepartmentService.GetALL().Where(x => departArray.Contains(x.ID));
            entity.Department.AddRange(DepartmentList);

            db.Add<JobTitleCate>(entity);
            db.Commit();
            return entity;
        }
예제 #3
0
 public void Delete(JobTitleCate model)
 {
     var target = Find(model.ID);
     db.Remove<JobTitleCate>(target);
     db.Commit();
 }
예제 #4
0
 public void Create(JobTitleCate model)
 {
     db.Add<JobTitleCate>(model);
     db.Commit();
 }