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