Ejemplo n.º 1
0
        public IActionResult Delete(int id)
        {
            var service = _serviceRepo.GetIdBy(id);

            _serviceRepo.Delete(service);
            return(View("Services", GetList()));
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 4
0
        public async Task <ServiceDTO> DeleteAsync(long Id)
        {
            Service result = await _serviceRepository.Delete(Id);

            var service = _mapper.Map <Service, ServiceDTO>(result);

            return(service);
        }
Ejemplo n.º 5
0
        public void DeleteService(Expression <Func <Services, bool> > where)
        {
            var listService = _repository.GetMany(where);

            foreach (var i in listService)
            {
                _repository.Delete(i);
            }
        }
Ejemplo n.º 6
0
        public void Delete(int idSelected)
        {
            var serviceFromDb = _repository.GetServiceById(idSelected);

            if (serviceFromDb != null)
            {
                _repository.Delete(idSelected);
            }
        }
Ejemplo n.º 7
0
        public void Delete(int id)
        {
            var item = _repository.GetAll().FirstOrDefault(u => u.Id == id);

            if (item != null)
            {
                _repository.Delete(item);
                _repository.SaveCganges();
            }
        }
Ejemplo n.º 8
0
 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),
     });
 }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 12
0
        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);
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
        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());
            }
        }
Ejemplo n.º 15
0
        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
            });
        }
Ejemplo n.º 17
0
        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));
            }
        }
Ejemplo n.º 18
0
        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());
        }
Ejemplo n.º 19
0
        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);
        }
Ejemplo n.º 21
0
 public void Delete(Service entity)
 {
     _servicerepository.Delete(entity);
 }
Ejemplo n.º 22
0
        public virtual async Task <ApiResult> Delete(TKey id, CancellationToken cancellationToken)
        {
            await serviceRepository.Delete(id, cancellationToken);

            return(Ok());
        }
Ejemplo n.º 23
0
 public IActionResult Delete(int id)
 {
     _serviceRepository.Delete(id);
     return(RedirectToAction("index", "service"));
 }
Ejemplo n.º 24
0
 public static void Delete(Service obj)
 {
     _repository.Delete(obj);
 }
Ejemplo n.º 25
0
 public void Delete(RestServiceIdDto dto)
 {
     _serviceRepository.Delete(dto.Id);
 }
Ejemplo n.º 26
0
 public IActionResult Delete_Post(int id)
 {
     EmployeeRepository.Delete(id);
     return(RedirectToAction("Index"));
 }
Ejemplo n.º 27
0
 public void Delete(Guid id)
 {
     _serviceRepository.Delete(id);
 }
        public ActionResult DeleteService(int id)
        {
            _repository.Delete(id);

            return(NoContent());
        }
Ejemplo n.º 29
0
 public async Task <RepositoryResponce> Delete(TKey key) => await _ServiceRepository.Delete(CombineUrl(), key);
Ejemplo n.º 30
0
 public Model.Models.Service Delete(int id)
 {
     return(_serviceRepository.Delete(id));
 }