コード例 #1
0
        public void AddWorkmanship(WorkmanshipPostModel work)
        {
            Workmanship workmanship = new Workmanship()
            {
                time       = work.time,
                price      = work.price,
                operations = work.operations,
                ID_repair  = work.ID_repair
            };

            DbContext.Workmanships.Add(workmanship);
            DbContext.SaveChanges();
        }
コード例 #2
0
        public void UpdateWorkmanship(int id, WorkmanshipPostModel work)
        {
            var workmanship = DbContext.Workmanships.SingleOrDefault(b => b.workmanshipID == id);

            if (workmanship != null)
            {
                workmanship.time       = work.time;
                workmanship.price      = work.price;
                workmanship.operations = work.operations;
                workmanship.ID_repair  = work.ID_repair;

                DbContext.SaveChanges();
            }
        }