// GET: /Export public FileStreamResult Export(int id) { string clientProfileBuilderText = GDSIntegration.WriteGDSProfile(id); var byteArray = Encoding.ASCII.GetBytes(clientProfileBuilderText); var stream = new MemoryStream(byteArray); return(File(stream, "text/plain", string.Format("ClientProfileGroup-{0}.txt", id.ToString()))); }
// GET: /Publish public ActionResult Publish(int id) { ClientProfileGroup clientProfileGroup = new ClientProfileGroup(); clientProfileGroup = clientProfileGroupRepository.GetGroup(id); //Check Exists if (clientProfileGroup == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } ClientProfileGroupVM clientProfileGroupVM = new ClientProfileGroupVM(); clientProfileGroupRepository.EditGroupForDisplay(clientProfileGroup); clientProfileGroupVM.ClientProfileGroup = clientProfileGroup; //Get ClientTopUnit if (clientProfileGroup.HierarchyType == "ClientSubUnit") { ClientProfileGroupClientSubUnit clientProfileGroupClientSubUnit = clientProfileGroup.ClientProfileGroupClientSubUnits.SingleOrDefault(); if (clientProfileGroupClientSubUnit != null) { ClientSubUnitRepository clientSubUnitRepository = new ClientSubUnitRepository(); ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(clientProfileGroupClientSubUnit.ClientSubUnitGuid); if (clientSubUnit != null) { if (clientSubUnit.ClientTopUnit != null) { ViewData["ClientTopUnitName"] = clientSubUnit.ClientTopUnit.ClientTopUnitName; } } } } //GDS Window string clientProfileBuilderText = GDSIntegration.WriteGDSProfile(id); if (!string.IsNullOrEmpty(clientProfileBuilderText)) { ViewData["clientProfileText"] = clientProfileBuilderText; } return(View(clientProfileGroupVM)); }