public async Task <bool> Delete(ServiceLocationAppointment entity) { try { _dbContext.ServiceLocationAppointments.Remove(entity); await _dbContext.SaveChangesAsync(); return(true); } catch (Exception e) { return(false); } }
public async Task <bool> Insert(ServiceLocationAppointment entity) { entity.CarManufacturerId = entity.CarManufacturer.CarManufacturerId; entity.ServiceLocationOperationId = entity.ServiceLocationOperation.ServiceLocationOperationId; entity.ServiceLocationId = entity.ServiceLocation.ServiceLocationId; entity.CarManufacturer = null; entity.ServiceLocation = null; entity.ServiceLocationOperation = null; try { await _dbContext.ServiceLocationAppointments.AddAsync(entity); await _dbContext.SaveChangesAsync(); return(true); } catch (Exception e) { return(false); } }