public IActionResult Delete(int id) { var service = _serviceRepo.GetIdBy(id); _serviceRepo.Delete(service); return(View("Services", GetList())); }
public async Task <IActionResult> Delete(int id) { try { if (id < 1) { return(BadRequest()); } var isExists = await _serviceRepository.isExists(id); if (!isExists) { return(NotFound()); } var service = await _serviceRepository.FindById(id); var isSuccess = await _serviceRepository.Delete(service); if (!isSuccess) { return(InternalError($"Delete failed")); } return(NoContent()); } catch (Exception e) { return(InternalError($"{e.Message} - {e.InnerException}")); } }
public async Task DeleteService(string id) { var service = await _serviceRepository.Get(new ObjectId(id)); await _serviceRepository.Delete(new ObjectId(id)); await _heartbeatRepository.Remove(service.Name, service.InstanceLocation); }
public async Task <ServiceDTO> DeleteAsync(long Id) { Service result = await _serviceRepository.Delete(Id); var service = _mapper.Map <Service, ServiceDTO>(result); return(service); }
public void DeleteService(Expression <Func <Services, bool> > where) { var listService = _repository.GetMany(where); foreach (var i in listService) { _repository.Delete(i); } }
public void Delete(int idSelected) { var serviceFromDb = _repository.GetServiceById(idSelected); if (serviceFromDb != null) { _repository.Delete(idSelected); } }
public void Delete(int id) { var item = _repository.GetAll().FirstOrDefault(u => u.Id == id); if (item != null) { _repository.Delete(item); _repository.SaveCganges(); } }
public void Delete(int id, string user = "") { _serviceRepository.Delete(x => x.id == id); //ToDo : réaliser une suppression complète ou logique en fonction des droits de l'utilisateur en session _applicationTraceService.create(new ApplicationTrace { utilisateur = user, action = Parametres.Action.Suppression.ToString(), description = String.Format("Supression d'un service service_id = {0}", id), }); }
public bool Delete(int id) { var res = GetById(id); if (res != null) { _serviceRepository.Delete(id); _unitOfWork.Complete(); return(true); } return(false); }
public ActionResult Delete([FromBody] UserSubscribeRequest value) { var subscription = _subscriptionRepository.GetSubscriptionTo(value.UserId, value.ServiceId); if (subscription == null) { return(NotFound()); } _serviceRepository.Delete(subscription.Id); return(NoContent()); }
public Service Delete(Guid id) { var Service = _repository.GetOne(id); _repository.Delete(Service); if (Commit()) { return(Service); } return(null); }
public void Register(ServiceCollection services) { var list = services.Services .Select(s => new DkmsServiceEntity { Host = services.Host, Service = s }).ToList(); var currents = _serviceQueryRepository.QueryByHost(services.Host); var news = list.Where(s => !currents.Any(x => s.Service == s.Service)); _serviceRepository.Add(news); var removes = currents.Where(s => !news.Any(x => s.Service == s.Service)); _serviceRepository.Delete(removes); }
public int DeleteService(int serviceId) { int deleteIndex = 0; try { Service service = GetAllById(serviceId); service.IsActive = false; deleteIndex = _serviceRepository.Delete(service); } catch (Exception exception) { throw new Exception(exception.Message); } return(deleteIndex); }
public async Task <bool> DeleteService(Guid id) { try { var service = await GetServiceById(id); _serviceRepository.Delete(service); await _serviceRepository.SaveAsync(); return(true); } catch (Exception ex) { throw new Exception(ex.ToString()); } }
public ActionResult DeleteAjax(int id) { if (!ViewBag.HasAccessToAdminModule) { BaseModel baseModel = new BaseModel(); baseModel.ErrorMessage = "You are not eligible to do this action"; return(Json(new { success = false, data = this.RenderPartialViewToString(Constants.PartialViews.AlertSliding, baseModel) }, JsonRequestBehavior.AllowGet)); } //find the service in database Service service = serviceRepository.Find(id); if (service == null) { //set error message if it does not exist in database service = new Service(); service.ErrorMessage = "Service not found"; } else { try { //delete service from database serviceRepository.Delete(service); serviceRepository.Save(); //set success message service.SuccessMessage = "Service has been deleted successfully"; } catch (CustomException ex) { service.ErrorMessage = ex.UserDefinedMessage; } catch (Exception ex) { ExceptionManager.Manage(ex); service.ErrorMessage = Constants.Messages.UnhandelledError; } } //return action status in json to display on a message bar if (service.ErrorMessage.IsNotNullOrEmpty()) { return(Json(new { success = false, data = this.RenderPartialViewToString(Constants.PartialViews.AlertSliding, service) })); } else { return(Json(new { success = true, data = this.RenderPartialViewToString(Constants.PartialViews.AlertSliding, service) })); } }
public async Task Handle(RemoveServiceCommand message) { if (message == null) { throw new ArgumentNullException(nameof(message)); } var service = await _serviceRepository.Get(message.ServiceId); await _serviceRepository.Delete(message.ServiceId); _eventPublisher.Publish(new ServiceRemovedEvent { ServiceId = message.ServiceId, CommonId = message.CommonId, ShopId = service.ShopId }); }
public async Task <ServiceResponse> Delete(int id) { var item = await _serviceRepository.GetById(id); if (item == null) { throw new KeyNotFoundException(); } try { _serviceRepository.Delete(item); await _context.SaveChangesAsync(); return(new ServiceResponse()); } catch (Exception exception) { string errorMessage = $"An error occured when deleting the item: {exception.Message}"; return(new ServiceResponse(errorMessage)); } }
public async Task <IActionResult> Delete(int id) { try { _logger.LogInformation($"Deleting service with id={id}"); var service = await _serviceRepository.GetById(id); if (service == null) { return(NotFound()); } await _serviceRepository.Delete(service); return(Ok()); } catch (Exception e) { _logger.LogError($"Error during delete service with id={id}", e); } return(BadRequest()); }
public Message Delete(int serviceId) { var message = new Message(); try { int result = _iServiceRepository.Delete(serviceId); if (result > 0) { message = Message.SetMessages.SetSuccessMessage("Service Deleted Successfully."); } else { message = Message.SetMessages.SetErrorMessage("Failed to Delete Data."); } } catch (Exception ex) { message = Message.SetMessages.SetErrorMessage(ex.Message); } return(message); }
/// <summary> /// Removes the service. /// </summary> /// <param name="id">The identifier.</param> public void RemoveService(Guid id) { Service service = GetService(id); serviceRepository.Delete(service); }
public void Delete(Service entity) { _servicerepository.Delete(entity); }
public virtual async Task <ApiResult> Delete(TKey id, CancellationToken cancellationToken) { await serviceRepository.Delete(id, cancellationToken); return(Ok()); }
public IActionResult Delete(int id) { _serviceRepository.Delete(id); return(RedirectToAction("index", "service")); }
public static void Delete(Service obj) { _repository.Delete(obj); }
public void Delete(RestServiceIdDto dto) { _serviceRepository.Delete(dto.Id); }
public IActionResult Delete_Post(int id) { EmployeeRepository.Delete(id); return(RedirectToAction("Index")); }
public void Delete(Guid id) { _serviceRepository.Delete(id); }
public ActionResult DeleteService(int id) { _repository.Delete(id); return(NoContent()); }
public async Task <RepositoryResponce> Delete(TKey key) => await _ServiceRepository.Delete(CombineUrl(), key);
public Model.Models.Service Delete(int id) { return(_serviceRepository.Delete(id)); }