Esempio n. 1
0
        public async Task <ActualResult> UpdateAsync(WellnessFamilyDTO 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)));
            }
        }
        public async Task <ActualResult> CreateAsync(WellnessFamilyDTO 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)));
            }
        }
Esempio n. 3
0
        public async Task <ActualResult <string> > CreateAsync(WellnessFamilyDTO item)
        {
            try
            {
                var wellnessFamily = _mapper.Map <EventFamily>(item);
                await _context.EventFamily.AddAsync(wellnessFamily);

                await _context.SaveChangesAsync();

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