예제 #1
0
        public JobTypeVo insert(JobTypeVo input)
        {
            using (var db = new MainDb())
            {

                db.jobTypes.Add(input);
                db.SaveChanges();

                return input;
            }
        }
예제 #2
0
        public JobTypeVo update(JobTypeVo input, int? jobTypeId= null)
        {
            using (var db = new MainDb())
            {

                if (jobTypeId == null)
                    jobTypeId = input.jobTypeId;

                var res = db.jobTypes.FirstOrDefault(e => e.jobTypeId == jobTypeId);

                if (res == null) return null;

                input.created = res.created;
               // input.createdBy = res.createdBy;
                db.Entry(res).CurrentValues.SetValues(input);

                db.SaveChanges();
                return res;

            }
        }