Ejemplo n.º 1
0
        public RouteDto AddRoute(RouteDto route)
        {
            var newRoute = route.MapTo <Route>();

            _writeRepository.Add(newRoute);
            _unitOfWork.Commit();
            return(newRoute.MapTo <RouteDto>());
        }
Ejemplo n.º 2
0
        public RouteDto UpdateRoute(string id, RouteDto route)
        {
            var item = _readRepository.Get(x => x.Id.Equals(Guid.Parse(id))).FirstOrDefault();

            if (item != null)
            {
                _writeRepository.Update(route.MapTo <Route>());
                _unitOfWork.Commit();
                return(item.MapTo <RouteDto>());
            }
            throw new ArgumentException("The passed route doesn't exist.");
        }