Exemplo n.º 1
0
        public void DeleteServiceType(Expression <Func <ServiceType, bool> > where)
        {
            var ListServiceType = _repository.GetMany(where);

            foreach (var i in ListServiceType)
            {
                _repository.Delete(i);
            }
        }
Exemplo n.º 2
0
        public async Task <ServiceTypeDto> DeleteAsync(int id)
        {
            var service = await GetByIdOrThrowAsync(id);

            _serviceTypeRepository.Delete(service);
            await SaveProvider.SaveAsync();

            return(Mapper.Map <ServiceTypeDto>(service));
        }
Exemplo n.º 3
0
        /// <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();
        }
Exemplo n.º 4
0
 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());
     }
 }
Exemplo n.º 5
0
        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));
        }