public MyDBModels.RepairList getDataById(int id)
        {
            var db = new MyDBModels.DB();

            MyDBModels.RepairList repairModel = db.repairList.Where(b => b.ServiceListId == id).FirstOrDefault();
            return(repairModel);
        }
        // DELETE api/values/
        public void Delete(int id)
        {
            var db = new MyDBModels.DB();

            MyDBModels.RepairList repairList = db.repairList.Where(rl => rl.ListServiceId == id).FirstOrDefault();
            if (repairList != null)
            {
                db.repairList.Remove(repairList);
                db.SaveChanges();
            }
        }
        // POST api/values
        public void Post(Models.RepairListModel value)
        {
            var db = new MyDBModels.DB();

            MyDBModels.RepairList repairList = new MyDBModels.RepairList();
            repairList.BusId        = value.BusId;
            repairList.BusCondition = value.BusCondition;
            repairList.TimeGet      = value.TimeGet;
            db.repairList.Add(repairList);
            db.SaveChanges();
        }
        public void postRepair(Models.RepairListModel value, int number)
        {
            var db       = new MyDBModels.DB();
            int idDriver = db.driver.Where(d => d.DriverNumber == number).FirstOrDefault().DriverId;

            MyDBModels.WorkList work = db.workList.Where(d => d.DriverId == idDriver && d.DateAction == value.TimeGet).FirstOrDefault();

            MyDBModels.RepairList repairList = new MyDBModels.RepairList();
            repairList.BusId        = work.BusId;
            repairList.BusCondition = value.BusCondition;
            repairList.TimeGet      = value.TimeGet;
            db.repairList.Add(repairList);
            db.SaveChanges();
        }
Beispiel #5
0
 public MyDBModels.RepairList logicMethodForGetData(int id)
 {
     MyDBModels.RepairList data = dataAccess.getDataById(id);
     return(data);
 }