Пример #1
0
 public void Create(EventServiceDto eventService)
 {
     if (eventService == null)
     {
         throw new ArgumentNullException(nameof(EventServiceDto));
     }
     repository.Add(new DataLayer.Entities.EventService().InjectFrom(eventService) as DataLayer.Entities.EventService);
     unit.Commit();
 }
Пример #2
0
        public void Update(EventServiceDto eventService)
        {
            if (eventService == null)
            {
                throw new ArgumentNullException(nameof(EventServiceDto));
            }

            var eventServiceEntity = repository.GetById(eventService.Id).InjectFrom(eventService) as DataLayer.Entities.EventService;

            if (eventServiceEntity == null)
            {
                throw new Exception($"Cannot update eventService package with id = {eventService.Id}");
            }
            repository.Update(eventServiceEntity);
            unit.Commit();
        }