Ejemplo n.º 1
0
        public async Task <ActualResult> UpdateAsync(GiftEmployeesDTO item)
        {
            try
            {
                _context.Entry(_mapper.Map <GiftEmployees>(item)).State = EntityState.Modified;
                await _context.SaveChangesAsync();

                return(new ActualResult());
            }
            catch (Exception exception)
            {
                return(new ActualResult(DescriptionExceptionHelper.GetDescriptionError(exception)));
            }
        }
Ejemplo n.º 2
0
        public async Task <ActualResult> CreateAsync(GiftEmployeesDTO item)
        {
            try
            {
                await _context.GiftEmployees.AddAsync(_mapperService.Mapper.Map <GiftEmployees>(item));

                await _context.SaveChangesAsync();

                return(new ActualResult());
            }
            catch (Exception exception)
            {
                return(new ActualResult(DescriptionExceptionHelper.GetDescriptionError(exception)));
            }
        }
Ejemplo n.º 3
0
        public async Task <ActualResult <string> > CreateAsync(GiftEmployeesDTO item)
        {
            try
            {
                var giftEmployees = _mapper.Map <GiftEmployees>(item);
                await _context.GiftEmployees.AddAsync(giftEmployees);

                await _context.SaveChangesAsync();

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