public async Task <ActualResult> UpdateAsync(GiftGrandChildrenDTO item) { try { _context.Entry(_mapper.Map <GiftGrandChildrens>(item)).State = EntityState.Modified; await _context.SaveChangesAsync(); return(new ActualResult()); } catch (Exception exception) { return(new ActualResult(DescriptionExceptionHelper.GetDescriptionError(exception))); } }
public async Task <ActualResult> CreateAsync(GiftGrandChildrenDTO item) { try { await _context.GiftGrandChildrens.AddAsync(_mapperService.Mapper.Map <GiftGrandChildrens>(item)); await _context.SaveChangesAsync(); return(new ActualResult()); } catch (Exception exception) { return(new ActualResult(DescriptionExceptionHelper.GetDescriptionError(exception))); } }
public async Task <ActualResult <string> > CreateAsync(GiftGrandChildrenDTO item) { try { var giftGrandChildren = _mapper.Map <GiftGrandChildrens>(item); await _context.GiftGrandChildrens.AddAsync(giftGrandChildren); await _context.SaveChangesAsync(); var hashId = HashHelper.EncryptLong(giftGrandChildren.Id); return(new ActualResult <string> { Result = hashId }); } catch (Exception exception) { return(new ActualResult <string>(DescriptionExceptionHelper.GetDescriptionError(exception))); } }