public IActionResult Create(Guid?repositoryId = null) { if (repositoryId.HasValue) { ShapeConfigCreateModel shapeConfigViewModel = new ShapeConfigCreateModel() { RepositoryID = repositoryId.Value }; return(View(shapeConfigViewModel)); } return(View()); }
public ShapeConfigViewModel CreateShapeConfig(ShapeConfigCreateModel newRepositoryConfigView) { Guid guidAdded; string parameters = $"?name={newRepositoryConfigView.Name}&repositoryID={newRepositoryConfigView.RepositoryID}"; string result = _serviceApi.CallPostApi($"{_urlShapeConfigApi}{parameters}", newRepositoryConfigView.ShapeFile, true); result = JsonConvert.DeserializeObject <string>(result); Guid.TryParse(result, out guidAdded); result = _serviceApi.CallGetApi($"{_urlShapeConfigApi}/{guidAdded}"); ShapeConfigViewModel resultObject = JsonConvert.DeserializeObject <ShapeConfigViewModel>(result); return(resultObject); }
public IActionResult Create(ShapeConfigCreateModel shapeConfigViewModel)/*Guid ShapeConfigID,string Name, Guid RepositoryID, IFormFile ShapeFile)*/ { try { var repository = _repositoryServiceApi.GetRepositoryConfig(shapeConfigViewModel.RepositoryID); if (repository == null) { ModelState.AddModelError("RepositoryID", "No existe el repositorio"); return(View("Create", shapeConfigViewModel)); } else { ShapeConfigViewModel result = _serviceApi.CreateShapeConfig(shapeConfigViewModel); return(RedirectToAction("Details", new { id = result.ShapeConfigID })); } } catch (BadRequestException) { return(BadRequest()); } }