コード例 #1
0
 public void AddTimeSlots(TimeSlotEntity timeSlots)
 {
     using (IDbConnection con = new SQLiteConnection(AppData.ConnectionString))
     {
         con.Execute("INSERT INTO TimeSlotTable (ID, Days, TimeSlots, SessionId) values (@ID, @Days, @TimeSlots, @SessionId)", timeSlots);
     }
 }
コード例 #2
0
 // PUT: api/TimeSlot/5
 public bool Put(int id, [FromBody] TimeSlotEntity TimeSlotEntity)
 {
     if (id > 0)
     {
         return(_TimeSlotServices.UpdateTimeSlot(id, TimeSlotEntity));
     }
     return(false);
 }
コード例 #3
0
 public int CreateTimeSlot(TimeSlotEntity timeSlotEntity)
 {
     using (var scope = new TransactionScope())
     {
         var timeSlot = new TimeSlot()
         {
             id          = timeSlotEntity.id,
             name        = timeSlotEntity.name,
             description = timeSlotEntity.description,
         };
         _unitOfWork.TimeSlotRepository.Insert(timeSlot);
         _unitOfWork.Save();
         scope.Complete();
         return(timeSlot.id);
     }
 }
コード例 #4
0
        public bool UpdateTimeSlot(int timeSlotId, TimeSlotEntity timeSlotEntity)
        {
            var success = false;

            if (timeSlotEntity != null)
            {
                using (var scope = new TransactionScope())
                {
                    var timeSlot = _unitOfWork.TimeSlotRepository.GetByID(timeSlotId);
                    if (timeSlot != null)
                    {
                        timeSlot.name        = timeSlotEntity.name;
                        timeSlot.description = timeSlotEntity.description;
                        _unitOfWork.Save();
                        scope.Complete();
                        success = true;
                    }
                }
            }
            return(success);
        }
コード例 #5
0
 public void SaveTimeSlotsData(TimeSlotEntity timeSlotEntity)
 {
     _workData.AddTimeSlots(timeSlotEntity);
 }
コード例 #6
0
 // POST: api/TimeSlot
 public int Post([FromBody] TimeSlotEntity TimeSlotEntity)
 {
     return(_TimeSlotServices.CreateTimeSlot(TimeSlotEntity));
 }