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