public void DeleteServiceType(Expression <Func <ServiceType, bool> > where) { var ListServiceType = _repository.GetMany(where); foreach (var i in ListServiceType) { _repository.Delete(i); } }
public async Task <ServiceTypeDto> DeleteAsync(int id) { var service = await GetByIdOrThrowAsync(id); _serviceTypeRepository.Delete(service); await SaveProvider.SaveAsync(); return(Mapper.Map <ServiceTypeDto>(service)); }
/// <summary> /// Delete Service Type by id /// </summary> public void DeleteServiceType(long serviceTypeId) { ServiceType dbversion = serviceTypeRepository.Find((int)serviceTypeId); ValidateBeforeDeletion(serviceTypeId); if (dbversion == null) { throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Service Type with Id {0} not found!", serviceTypeId)); } serviceTypeRepository.Delete(dbversion); serviceTypeRepository.SaveChanges(); }
public async Task <IActionResult> Delete(string id) { try { return(Ok(await _repository.Delete(id))); } catch (Exception exc) { _logger.LogError($"Error: {exc}"); // transaction.Rollback(); return(NotFound()); } }
public async Task <IActionResult> DeleteServiceType(int id) { var st = await _repository.GetServiceTypeAsync(id); if (st == null) { return(NotFound()); } _repository.Delete(st); await _unitOfWork.CompleteAsync(); return(Ok(id)); }