public static string PrintIPDetails(IpDetailModel model) { var builder = new StringBuilder() .AppendLine() .AppendLine($"IP address: {model.IPAddress}") .AppendLine($"Allocation Prefix: {model.RIRAllocationPrefix}") .AppendLine($"Country Code: {model.CountryCode}") .AppendLine($"PTR Record: {model.PtrRecord}") .AppendLine("Related Prefixes: ") .AppendLine(); var padding = new string(' ', 2); for (int i = 0; i < model.RelatedPrefixes.Count(); i++) { builder .AppendLine($"{padding}Prefix: {model.RelatedPrefixes.ElementAt(i).Prefix}") .AppendLine($"{padding}Name: {model.RelatedPrefixes.ElementAt(i).Name}") .AppendLine($"{padding}Description: {model.RelatedPrefixes.ElementAt(i).Description}") .AppendLine($"{padding}Parent asns:") .AppendLine(); for (int j = 0; j < model.RelatedPrefixes.ElementAt(i).ParentAsns.Count(); j++) { builder.AppendLine(PrintAsnModelWithPadding(model.RelatedPrefixes.ElementAt(i).ParentAsns.ElementAt(j), 4)); } } return(builder.ToString()); }
public ActionResult CreateProvider(IpDetailModel model) { //var model = new IpDetailModel(); if (ModelState.IsValid) { var svc = new AppService(); svc.CreateIpDetail( model.IpNumber, model.IspProvider, model.Country, model.Location, model.State ); return(RedirectToAction("Index")); } return(View()); }
public ActionResult EditIpDetail(IpDetailModel model) { //var model = new IpDetailModel(); if (ModelState.IsValid) { var svc = new AppService(); svc.EditIpDetail( model.IpDetailId, model.IpNumber, model.IspProvider, model.Country, model.Location, model.State, model.IsHidden, model.Alias ); return(RedirectToAction("IpDetails")); } return(View()); }
public ActionResult EditIpDetail(string id) { var svc = new AppService(); var detail = svc.GetIpDetailById(id); var modelId = id; IpDetailModel detailView = new IpDetailModel { IpNumber = detail.IpNumber, IspProvider = detail.IspProvider, Location = detail.Location, State = detail.State, Country = detail.Country, IpDetailId = modelId, IsHidden = detail.IsHidden, Alias = detail.Alias }; return(View(detailView)); }