public async Task <ActualResult> UpdateAsync(TravelFamilyDTO item)
        {
            try
            {
                _context.Entry(_mapperService.Mapper.Map <EventFamily>(item)).State = EntityState.Modified;
                await _context.SaveChangesAsync();

                return(new ActualResult());
            }
            catch (Exception exception)
            {
                return(new ActualResult(DescriptionExceptionHelper.GetDescriptionError(exception)));
            }
        }
        public async Task <ActualResult> CreateAsync(TravelFamilyDTO 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(TravelFamilyDTO item)
        {
            try
            {
                var travelFamily = _mapper.Map <EventFamily>(item);
                await _context.EventFamily.AddAsync(travelFamily);

                await _context.SaveChangesAsync();

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