示例#1
0
        public bool Create(IntendedDto intendedDto)
        {
            var intended        = _mapper.Map <IntendedDto, Intended>(intendedDto);
            var intendedDetails = _mapper.Map <List <IntendedDetailDto>, List <IntendedDetail> >(intendedDto.Details);

            _unitOfWorfkMedia.IntendedRepository.Add(intended);
            _unitOfWorfkMedia.IntendedDetailRepository.AddRange(intendedDetails);

            return(_unitOfWorfkMedia.SaveChanges() > 0);
        }
示例#2
0
        public bool Update(IntendedDto data)
        {
            var intended        = _mapper.Map <IntendedDto, Intended>(data);
            var intendedDetails = _mapper.Map <List <IntendedDetailDto>, List <IntendedDetail> >(data.Details);

            _unitOfWorfkMedia.IntendedRepository.Update(intended, UpdateAccessMode.DENY_UPDATE, "CreateBy", "CreateDate");
            _unitOfWorfkMedia.IntendedDetailRepository.Delete(o => o.IntendedId == data.Id);
            _unitOfWorfkMedia.IntendedDetailRepository.AddRange(intendedDetails);

            return(_unitOfWorfkMedia.SaveChanges() > 0);
        }