コード例 #1
0
        public async Task <ActualResult> UpdateAsync(HobbyGrandChildrenDTO item)
        {
            try
            {
                _context.Entry(_mapper.Map <HobbyGrandChildrens>(item)).State = EntityState.Modified;
                await _context.SaveChangesAsync();

                return(new ActualResult());
            }
            catch (Exception exception)
            {
                return(new ActualResult(DescriptionExceptionHelper.GetDescriptionError(exception)));
            }
        }
コード例 #2
0
        public async Task <ActualResult> CreateAsync(HobbyGrandChildrenDTO item)
        {
            try
            {
                await _context.HobbyGrandChildrens.AddAsync(_mapperService.Mapper.Map <HobbyGrandChildrens>(item));

                await _context.SaveChangesAsync();

                return(new ActualResult());
            }
            catch (Exception exception)
            {
                return(new ActualResult(DescriptionExceptionHelper.GetDescriptionError(exception)));
            }
        }
コード例 #3
0
        public async Task <ActualResult <string> > CreateAsync(HobbyGrandChildrenDTO item)
        {
            try
            {
                var hobbyGrandChildren = _mapper.Map <HobbyGrandChildrens>(item);
                await _context.HobbyGrandChildrens.AddAsync(hobbyGrandChildren);

                await _context.SaveChangesAsync();

                var hashId = HashHelper.EncryptLong(hobbyGrandChildren.Id);
                return(new ActualResult <string> {
                    Result = hashId
                });
            }
            catch (Exception exception)
            {
                return(new ActualResult <string>(DescriptionExceptionHelper.GetDescriptionError(exception)));
            }
        }