public GymDayServiceResponse CreateGymDay(GymDay newGymDay) { var result = new GymDayServiceResponse(); try { if (!IsThereAGymDayForToday()) { newGymDay.LastDone = DateTime.Now; _repo.Insert(newGymDay); result.ServiceResponseCode = GymDaysServiceResponseCodes.CreateSuccess; result.ListOfGymDays.Add(newGymDay); } result.ServiceResponseCode = GymDaysServiceResponseCodes.CreateFail; } catch (Exception e) { result.Exception = e; result.ServiceResponseCode = GymDaysServiceResponseCodes.CreateFail; } return result; }
internal GymDayServiceResponse UpdateGymDay(GymDay newSet) { var result = new GymDayServiceResponse(); try { // This operation returns a boolean, not sure how to leverage it. var workoutToUpdate = _repo.GetById(newSet.Id); workoutToUpdate.LastDone = newSet.LastDone; workoutToUpdate.Name = newSet.Name; workoutToUpdate.WorkoutsForDay = newSet.WorkoutsForDay; _repo.Update(workoutToUpdate); result.ServiceResponseCode = GymDaysServiceResponseCodes.UpdateSuccess; result.ListOfGymDays = new List<GymDay>() {workoutToUpdate}; } catch (Exception e) { result.Exception = e; result.ServiceResponseCode = GymDaysServiceResponseCodes.CreateFail; } return result; }
public GymDayServiceResponse CreateGymDay(GymDay newSet) { return _gymDayService.CreateGymDay(newSet); }
public GymDayServiceResponse AddSetToGymDay(GymDay newSet) { return _gymDayService.UpdateGymDay(newSet); }