public async Task Add(WorkDto worksDto) { try { var entity = _mapper.Map <Works>(worksDto); _databaseContex.Works.Add(entity); await _databaseContex.SaveChangesAsync(); await _distributedCache.RemoveAsync("servicerecords"); } catch (Exception exception) { throw new Exception(exception.Message); } }
public async Task ChangeStatus(int id) { try { var entity = await _databaseContex.Works.FirstOrDefaultAsync(x => x.Id == id); entity.Status = (int)StatusType.Tamamlandı; await _databaseContex.SaveChangesAsync(); await _distributedCache.RemoveAsync("servicerecords"); } catch (Exception exception) { throw new Exception(exception.Message); } }