コード例 #1
0
        public async Task <ActualResult> UpdateAsync(TourFamilyDTO item)
        {
            try
            {
                _context.Entry(_mapper.Map <EventFamily>(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(TourFamilyDTO item)
        {
            try
            {
                await _context.EventFamily.AddAsync(_mapperService.Mapper.Map <EventFamily>(item));

                await _context.SaveChangesAsync();

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

                await _context.SaveChangesAsync();

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