Beispiel #1
0
        public async Task <ActualResult> UpdateAsync(CulturalEmployeesDTO item)
        {
            try
            {
                _context.Entry(_mapperService.Mapper.Map <CulturalEmployees>(item)).State = EntityState.Modified;
                await _context.SaveChangesAsync();

                return(new ActualResult());
            }
            catch (Exception exception)
            {
                return(new ActualResult(DescriptionExceptionHelper.GetDescriptionError(exception)));
            }
        }
Beispiel #2
0
        public async Task <ActualResult> CreateAsync(CulturalEmployeesDTO item)
        {
            try
            {
                await _context.CulturalEmployees.AddAsync(_mapperService.Mapper.Map <CulturalEmployees>(item));

                await _context.SaveChangesAsync();

                return(new ActualResult());
            }
            catch (Exception exception)
            {
                return(new ActualResult(DescriptionExceptionHelper.GetDescriptionError(exception)));
            }
        }
Beispiel #3
0
        public async Task <ActualResult <string> > CreateAsync(CulturalEmployeesDTO item)
        {
            try
            {
                var culturalEmployees = _mapper.Map <CulturalEmployees>(item);
                await _context.CulturalEmployees.AddAsync(culturalEmployees);

                await _context.SaveChangesAsync();

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