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