Пример #1
0
 public Response_String Add_opening_hours([FromBody] Workshop_Opening_Hours New_Opening_Hours)
 {
     using (var db = new ITAPPCarWorkshopServiceDBEntities())
     {
         var Old = db.Workshop_Opening_Hours.FirstOrDefault(p => p.Workshop_ID == New_Opening_Hours.Workshop_ID);
         if (Old != null)
         {
             return(new Response_String()
             {
                 Response = "Item already exists"
             });
         }
         db.Workshop_Opening_Hours.Add(New_Opening_Hours);
         db.SaveChanges();
         return(new Response_String()
         {
             Response = "Item was added"
         });
     }
 }
Пример #2
0
 public Response_String Modifi_oppening_hours([FromBody] Workshop_Opening_Hours Modifi_hours)
 {
     using (var db = new ITAPPCarWorkshopServiceDBEntities())
     {
         var Old = db.Workshop_Opening_Hours.FirstOrDefault(p => p.WOH_ID == Modifi_hours.WOH_ID);
         if (Old != null)
         {
             var id = Old.WOH_ID;
             Old        = Modifi_hours;
             Old.WOH_ID = id;
             db.SaveChanges();
             return(new Response_String()
             {
                 Response = "Item was modify"
             });
         }
         return(new Response_String()
         {
             Response = "Item does not exsists"
         });
     }
 }