Exemplo n.º 1
0
        public void Insert(InsertRestServiceDto dto)
        {
            RestService restService = new RestService(dto.RequestUrl, dto.HttpMethod, dto.BodyFormat);
            string      jsonDetails = _jsonSerializer.Serialize(restService);
            Service     service     = new Service(dto.Name, ServiceType.REST, jsonDetails);

            _serviceRepository.Insert(service);
        }
        public ActionResult Create(IFormCollection collection)
        {
            try
            {
                InsertRestServiceDto dto = new InsertRestServiceDto();
                dto.Name       = collection["Name"];
                dto.RequestUrl = collection["RequestUrl"];
                dto.HttpMethod = collection["HttpMethod"];
                dto.BodyFormat = collection["BodyFormat"];

                _restServicesManager.Insert(dto);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }