public void AddWorkslot(WorkSlotViewModel model)
 {
     foreach (var attribute in model.GetType().GetProperties())
     {
         if (attribute.PropertyType.Name == "Boolean" && (Boolean)attribute.GetValue(model) == true && attribute.Name.Substring(attribute.Name.Length - 3) == "day")
         {
             WorkSlot slot = new WorkSlot()
             {
                 StartTime = model.StartTime,
                 EndTime   = model.EndTime,
                 ServiceID = model.ServiceID,
                 DayName   = attribute.Name.Substring(2)
             };
             ServiceBusinessLayer.AddWorkSlot(slot);
         }
     }
 }
Пример #2
0
 /// <summary>
 /// Adds workslot to the database
 /// </summary>
 /// <param name="slot">Workslot</param>
 public void AddWorkSlot(WorkSlot slot)
 {
     DBEntities.WorkSlots.Add(slot);
     DBEntities.SaveChanges();
 }