示例#1
0
 public async Task <StatusCodeResult> Delete(int id)
 {
     if (await _service.DeleteAsync(id) == 1)
     {
         return(StatusCode((int)HttpStatusCode.OK));
     }
     else
     {
         return(StatusCode((int)HttpStatusCode.ExpectationFailed));
     }
 }
        public async Task <ActionResult> DeleteSingleWorkshopService([FromRoute] int workshopId, [FromRoute] int serviceId)
        {
            Service service = await _serviceRepo.GetWorkshopSingleService(workshopId, serviceId);

            if (service == null)
            {
                return(NotFound(new { error = $"service with id {serviceId} could not be found in workshop with id {workshopId}" }));
            }
            else
            {
                await _serviceRepo.DeleteAsync(service);

                return(NoContent());
            }
        }
示例#3
0
        public async Task <IActionResult> DeleteService([FromForm] long Id)
        {
            try
            {
                if (Id <= 0)
                {
                    return(StatusCode((int)System.Net.HttpStatusCode.BadRequest, "Id not found!"));
                }
                else
                {
                    var result = await _serviceRepo.DeleteAsync(Id);

                    return(Ok());
                }
            }
            catch (Exception ex)
            {
                return(StatusCode((int)System.Net.HttpStatusCode.InternalServerError, ex.Message));
            }
        }
示例#4
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            try
            {
                var service = await _serviceRepository.GetByIdAsync(id);

                await _serviceRepository.DeleteAsync(service);
            }
            catch (Exception ex)
            {
                if (ex.InnerException.Message.Contains("REFERENCE constraint"))
                {
                    ViewBag.Error = $"This service is provided by dealerships, fist deactivate service and then update dealership in edit mode";
                    return(View());
                }
                else
                {
                    ModelState.AddModelError(string.Empty, ex.InnerException.Message);
                }
            }
            return(RedirectToAction(nameof(Index)));
        }
示例#5
0
        public IActionResult Delete(int id)
        {
            var res = catRepository.DeleteAsync(id).Result;

            return(RedirectToAction("Index"));
        }
示例#6
0
 public async Task Delete(int id)
 {
     await _serviceRepository.DeleteAsync(id);
 }
示例#7
0
 public async Task DeleteService(ServiceRequestModel serviceRequestModel)
 {
     var service = _mapper.Map <Service>(serviceRequestModel);
     await _serviceRepository.DeleteAsync(service);
 }
        async Task <bool> IServiceManager.Delete(Guid serviceId)
        {
            await _serviceRepository.DeleteAsync(serviceId);

            return(true);
        }
示例#9
0
        public async Task <Response> Handle(DeleteService request, CancellationToken cancellationToken)
        {
            await serviceRepository.DeleteAsync(request.Id);

            return(new Response("Serviço excluido com sucesso!"));
        }
示例#10
0
 public async Task <int> DeleteServiceAsync(int id)
 {
     return(await _repository.DeleteAsync(id));
 }
        public IActionResult Delete(int id, Category cat)
        {
            var res = repository.DeleteAsync(id).Result;

            return(Ok(res));
        }
示例#12
0
 public Task DeleteService(int id)
 {
     return(_serviceRepository.DeleteAsync(id));
 }