Пример #1
0
        public Core.Dto.Section Create(Core.Dto.Section sectionDto)
        {
            var section = sectionDto.ConvertToEntity();

            try
            {
                _unitOfWork.BeginTransaction();
                _unitOfWork.SectionRepository.Create(section);

                sectionDto = section.ConvertToDto();

                _unitOfWork.Commit();

                return(sectionDto);
            }
            catch
            { return(sectionDto); }
        }
Пример #2
0
        public Core.Dto.Section Update(Core.Dto.Section sectionDto)
        {
            var existingSectionDto = _unitOfWork.SectionRepository.Get(sectionDto.Id).ConvertToDto();

            existingSectionDto.Name      = sectionDto.Name;
            existingSectionDto.Sort_Key  = sectionDto.Sort_Key;
            existingSectionDto.Enabled   = sectionDto.Enabled;
            existingSectionDto.EditionId = sectionDto.EditionId;

            _unitOfWork.BeginTransaction();

            var section = _unitOfWork.SectionRepository.Update(existingSectionDto.ConvertToEntity());

            _unitOfWork.Commit();

            sectionDto = section.ConvertToDto();

            return(sectionDto);
        }
Пример #3
0
 public Core.Dto.Section Put(Core.Dto.Section section)
 {
     return(_sectionService.Update(section));
 }
Пример #4
0
 public Core.Dto.Section Post(Core.Dto.Section section)
 {
     return(_sectionService.Create(section));
 }