public bool Add(string serverName, string description, string url, bool isActive, string cityID) { Guid gCityID = new Guid(cityID); var city = CityRepository.GetQueryable().Single(c => c.CityID == gCityID); var server = new THOK.Authority.DbModel.Server() { ServerID = Guid.NewGuid(), ServerName = serverName, Description = description, Url = url, IsActive = isActive, City = city }; ServerRepository.Add(server); ServerRepository.SaveChanges(); return(true); }
// /Server/CreateExcelToClient/ public FileStreamResult CreateExcelToClient() { int page = 0, rows = 0; bool isactiveIsNull = true; string serverName = Request.QueryString["serverName"] ?? ""; string description = Request.QueryString["description"] ?? ""; string url = Request.QueryString["url"]; bool isactive=true; if (Request.QueryString["isactive"] != null && Request.QueryString["isactive"] != "") { isactiveIsNull = false; isactive = bool.Parse(Request.QueryString["isactive"]); } Server server = new Server(); server.ServerName = serverName; server.Description = description; server.Url = url; server.IsActive = isactive; ExportParam ep = new ExportParam(); ep.DT1 = ServerService.GetServer(page, rows, server,isactiveIsNull); ep.HeadTitle1 = "服务器信息"; return PrintService.Print(ep); }