public ActionResult Edit(ExampleModel example) { try { exampleManager.EditExample(example); return(RedirectToAction("Index", new { controller = "Example" })); } catch (AtomiaServerSideValidationException ex) { ex.AddModelStateErrors(ModelState, string.Empty); } try { if (!ModelState.IsValid) { return(View(example)); } } catch (Exception e) { HostingControlPanelLogger.LogHostingControlPanelException(e); } return(RedirectToAction("Index", new { controller = "Example" })); }
public ExampleModel FetchExample(string serviceId) { try { return(models[serviceId]); } catch (Exception ex) { HostingControlPanelLogger.LogHostingControlPanelException(ex); } return(new ExampleModel()); }
public ActionResult Add() { try { return(View(new ExampleModel())); } catch (Exception e) { HostingControlPanelLogger.LogHostingControlPanelException(e); } return(RedirectToAction("Index", new { controller = "Example" })); }
public List <ExampleModel> FetchObjectsWithPaging(string search, string iDisplayStart, string iDisplayLength, int sortColumn, string sortDirection, out long total) { var examples = new List <ExampleModel>(); total = 0; try { var serviceSearchCriteria = new ServiceSearchCriteria[] { new ServiceSearchCriteria { ParentService = null, ServicePath = exampleServiceData.Path, ServiceName = exampleServiceData.ServiceName } }; var searchDictionary = search.Length > 0 ? new Dictionary <string, string> { { exampleServiceData.ServiceProperties["Name"], "%*" + search + "%*" } } : null; var exampleServices = coreApi.FindServicesByPathWithPaging( out total, serviceSearchCriteria, searchDictionary, accountId, exampleServiceData.ServiceProperties["Name"], sortDirection.ToLower() == "asc", Convert.ToInt32(iDisplayStart) / Convert.ToInt32(iDisplayLength), Convert.ToInt32(iDisplayLength)); exampleServices = PackageSelectHelper.FilterServicesToSelectedPackage(controller.RouteData, exampleServices); foreach (var exampleService in exampleServices) { examples.Add(new ExampleModel { LogicalID = exampleService.logicalId, Name = GetServicePropertyValue(exampleService, "Name"), Status = GetServicePropertyValue(exampleService, "Status") }); } } catch (Exception ex) { HostingControlPanelLogger.LogHostingControlPanelException(ex); total = 0; } return(examples); }
public ActionResult Edit(string serviceID) { try { var serviceId = this.RouteData.Values["serviceID"].ToString(); var example = exampleManager.FetchExample(serviceId); return(View(example)); } catch (Exception e) { HostingControlPanelLogger.LogHostingControlPanelException(e); } return(RedirectToAction("Index", new { controller = "Example" })); }
public ExampleModel FetchExample(string serviceId) { try { var exampleService = coreApi.GetServiceById(serviceId, accountId); return(new ExampleModel { LogicalID = exampleService.logicalId, Name = GetServicePropertyValue(exampleService, "Name"), Status = GetServicePropertyValue(exampleService, "Status"), }); } catch (Exception ex) { HostingControlPanelLogger.LogHostingControlPanelException(ex); } return(new ExampleModel()); }
public List <ExampleModel> FetchObjectsWithPaging(string search, string iDisplayStart, string iDisplayLength, int sortColumn, string sortDirection, out long total) { var examples = new List <ExampleModel>(); total = 0; try { foreach (var example in models.Values) { examples.Add(example); } total = models.Count; } catch (Exception ex) { HostingControlPanelLogger.LogHostingControlPanelException(ex); total = 0; } return(examples); }