public ActionResult Create(AddContinentDto model) { try { if (ModelState.IsValid) { ContinentDto continent = new ContinentDto(); using (var repository = new WebApiClientRepository <ContinentDto>()) { var response = repository.Post(model, "Continent"); if (response != null) { if (response.data != null) { continent = JsonConvert.DeserializeObject <ContinentDto>(response.data.ToString()); TempData["message_data"] = response.message; return(RedirectToAction(nameof(Index))); } else { TempData["message_data"] = response.message; return(RedirectToAction(nameof(Index))); } } } } // TODO: Add insert logic here TempData["message_data"] = "Problem on Athlete adding"; return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
// GET: Continent/Create public ActionResult Create() { AddContinentDto continent = new AddContinentDto(); using (var repository = new WebApiClientRepository <TableConfigurationDto>()) { var payload = repository.GetList(null, "TableConfiguration/GetList"); if (payload != null) { if (payload.data != null) { continent.TableConfigurationDtos = JsonConvert.DeserializeObject <List <TableConfigurationDto> >(payload.data.ToString()); } } } return(View(continent)); }