Esempio n. 1
0
        public async Task <long> CreateOrUpdateReveice(ReceiveEditDto input)
        {
            BD_Receive item = input.MapTo <BD_Receive>();

            //BD_Receive src = _receiveRepository.Get(input.Id.Value).Attach();

            //context.Entry(model).State = System.Data.Entity.EntityState.Modified;
            return(await _receiveRepository.InsertOrUpdateAndGetIdAsync(item));
        }
Esempio n. 2
0
        public ReceiveEditDto GetReceiveById(NullableIdDto <long> input)
        {
            var receiveEditDto = new ReceiveEditDto();

            if (input.Id.HasValue) //Editing existing role?
            {
                Debug.Assert(input.Id != null, "编辑时,ID不得为空!");
                var currentReceive = _receiveRepository.Get(input.Id.Value);

                receiveEditDto = currentReceive.MapTo <ReceiveEditDto>();
            }

            return(receiveEditDto);
        }