// GET: DataLayer public DataLayerApiViewModel GetDataLayer(long id) { var dataLayersRepository = new DataLayersRepository(); var model = dataLayersRepository.GetById(id); return new DataLayerApiViewModel(model); }
// GET: BaseLayers/Delete/5 public ActionResult Delete(int id) { var dataLayersRepository = new DataLayersRepository(); var model = dataLayersRepository.GetById(id); if (model != null) return View(model); return HttpNotFound(); }
// GET: BaseLayers/Edit/5 public ActionResult Edit(long id) { var baseLayersRepository = new BaseLayersRepository(); IDisposable context; ViewBag.ListOfBaseLayers = baseLayersRepository.GetAll(out context).ToList().Select(x => new SelectListItem() { Value = x.Id.ToString(), Text = x.Name }); context?.Dispose(); var dataLayersRepository = new DataLayersRepository(); ViewBag.ListOfDataLayers = dataLayersRepository.GetAll(out context).ToList().Select(x => new SelectListItem() { Value = x.Id.ToString(), Text = x.Name }); context?.Dispose(); var model = dataLayersRepository.GetById(id); if (model != null) return View(model); return HttpNotFound(); }