public ResponseMessage DeleteComponent(int id)
        {
            ResponseMessage responseMessage = new ResponseMessage();

            responseMessage = _repository.DeleteComponent(id);
            return(responseMessage);
        }
Esempio n. 2
0
        public IActionResult Delete(int componentId)
        {
            Component deletedComponent = _cRepo.DeleteComponent(componentId);

            if (deletedComponent != null)
            {
                TempData["message"] = $"{deletedComponent.Name} was deleted";
            }
            return(RedirectToAction("Index"));
        }
        public IActionResult ManageComponent(long componentId, string buttonValue)
        {
            ViewBag.ComponentTypes = new SelectList(_componentTypeRepository.GetAllComponentTypes(), "ComponentTypeId", "ComponentName");
            var component = _componentRepository.GetComponent(componentId);

            switch (buttonValue)
            {
            case "Details":
                ComponentType componentType = _componentTypeRepository.GetComponentType(component.ComponentTypeId);
                ViewBag.ComponentTypeName = componentType.ComponentName;

                return(View("ComponentDetails", component));

            case "Edit":
                return(View("EditComponent", component));

            case "Delete":
                _componentRepository.DeleteComponent(componentId);
                return(Index());

            default:
                return(Index());
            }
        }
Esempio n. 4
0
        public async Task DeleteComponent(Guid id)
        {
            await _answerRepository.DeleteAnswersByComponentId(id);

            await _repository.DeleteComponent(id);
        }
Esempio n. 5
0
        public async Task <IActionResult> DeleteComponent(Guid id)
        {
            await _repository.DeleteComponent(id);

            return(Ok());
        }