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); } }
// PUT: api/TimeSlot/5 public bool Put(int id, [FromBody] TimeSlotEntity TimeSlotEntity) { if (id > 0) { return(_TimeSlotServices.UpdateTimeSlot(id, TimeSlotEntity)); } return(false); }
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); } }
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); }
public void SaveTimeSlotsData(TimeSlotEntity timeSlotEntity) { _workData.AddTimeSlots(timeSlotEntity); }
// POST: api/TimeSlot public int Post([FromBody] TimeSlotEntity TimeSlotEntity) { return(_TimeSlotServices.CreateTimeSlot(TimeSlotEntity)); }