Example #1
0
        public ServiceCallResult CancelStop(int id)
        {
            ServiceCallResult result = new ServiceCallResult() { Success = false };

            var stop = GetStop(id);

            stop.Canceled = true;

            result = EditStop(stop);

            return result;
        }
Example #2
0
        public ServiceCallResult CreateTruck(FoodTruck truck)
        {
            ServiceCallResult result = new ServiceCallResult() { Success = false };

            try
            {
                truck.UrlSlug = GenerateUrlSlug(truck.Name);

                repository.Add<FoodTruck>(truck);
                repository.SaveChanges();
                result.Success = true;
            }
            catch (Exception ex)
            {
                string[] errors = new[] { ex.Message };
                result.Errors = errors;
                result.Success = false;
            }
            return result;
        }
Example #3
0
        public ServiceCallResult EditTruck(FoodTruck truck)
        {
            ServiceCallResult result = new ServiceCallResult() { Success = false };

            try
            {
                repository.SaveChanges();
                result.Success = true;
            }
            catch (Exception ex)
            {
                string[] errors = new[] { ex.Message };
                result.Errors = errors;
                result.Success = false;
            }
            return result;
        }
Example #4
0
        public ServiceCallResult CreateStop(ScheduledStop stop)
        {
            ServiceCallResult result = new ServiceCallResult() { Success = false };

            try
            {
                repository.Add<ScheduledStop>(stop);
                repository.SaveChanges();
                result.Success = true;
            }
            catch (Exception ex)
            {
                string[] errors = new[] { ex.Message };
                result.Errors = errors;
                result.Success = false;
            }
            return result;
        }
Example #5
0
        public ServiceCallResult EditStop(ScheduledStop stop)
        {
            ServiceCallResult result = new ServiceCallResult() { Success = false };

            repository.SaveChanges();

            return result;
        }
Example #6
0
        public ServiceCallResult CreateStopException(DateTime day, int id)
        {
            ServiceCallResult result = new ServiceCallResult() { Success = false };
            RecurringException exception = new RecurringException()
            {
                Day = day.Date,
                ScheduledStopId = id
            };
            repository.Add<RecurringException>(exception);
            repository.SaveChanges();

            return result;
        }