public ActionResult LoadSiteInfoNotesTable(int id, int noteId) { var siteInfoNotes = _context.SiteInfoNotes.Where(n => n.CustomerId == id).ToList(); var note = _context.SiteInfoNotes.FirstOrDefault(n => n.Id == noteId); if (note == null) { var viewModel = new SiteInfoViewModel { Notes = siteInfoNotes, NoteTitle = "", NoteId = 0 }; return(PartialView("_SiteInfoNotesTable", viewModel)); } else { var viewModel = new SiteInfoViewModel { Notes = siteInfoNotes, NoteTitle = note.Title, NoteContent = note.Note, NoteId = note.Id }; return(PartialView("_SiteInfoNotesTable", viewModel)); } }
public void SaveSiteInfoTabNote(int id, string note, string noteType) { var parsedType = noteType.Substring(0, noteType.Length - 4); var siteNotes = _context.SiteInfoNotes.Where(n => n.CustomerId == id).ToList(); var servers = _context.CustomerServers.Where(s => s.CustomerId == id).ToList(); var siteInfo = _context.SiteInfos.Single(s => s.CustomerId == id); var siteInfoVm = new SiteInfoViewModel { Id = siteInfo.Id, CustomerId = siteInfo.CustomerId, NetworkInfo = siteInfo.NetworkInfo, WifiInfo = siteInfo.WifiInfo, DomainInfo = siteInfo.DomainInfo, Notes = siteNotes }; switch (parsedType) { case "Network": siteInfo.NetworkInfo = note; break; case "Wifi": siteInfo.WifiInfo = note; break; case "Domain": siteInfo.DomainInfo = note; break; } _context.SaveChanges(); }
public ActionResult SiteInfo(SiteInfoViewModel model, List <UploadViewModel> ImageModel) { var result = new CiResult(); var uploadResult = FileUpload(ImageModel); if (!uploadResult.IsSuccess) { result.Message = uploadResult.Message; } else { model.MetaTagOgImage = uploadResult.Data; } //save if (string.IsNullOrEmpty(result.Message)) { result = service.Save(SystemSettingType.SiteInfo, model); } //web reset if (result.IsSuccess) { var applicationHelper = new ApplicationHelper(); applicationHelper.RemoveAll(); applicationHelper.Init(); } return(Json(result)); }
public async Task <IActionResult> SiteInfo() { var model = new SiteInfoViewModel(); using (var context = await createSiteContext()) { // Retrieving web with lists and masterpageurl loaded ==> SharePoint REST query var web = await context.Web.GetAsync(w => w.Title, w => w.Description, w => w.MasterUrl); model.Title = web.Title; model.Description = web.Description; model.MasterUrl = web.MasterUrl; } return(View("SiteInfo", model)); }
public ActionResult LoadCustomerInfoPartial(int custId, int btnId) { var customer = _context.Customers.Include(c => c.AccountType).Single(c => c.Id == custId); var siteInfo = _context.SiteInfos.FirstOrDefault(s => s.CustomerId == custId); var siteNotes = _context.SiteInfoNotes.Where(n => n.CustomerId == custId).ToList(); var serverList = _context.CustomerServers.Where(s => s.CustomerId == custId).ToList(); var siteInfoVm = new SiteInfoViewModel { Id = siteInfo.Id, CustomerId = siteInfo.CustomerId, NetworkInfo = siteInfo.NetworkInfo, WifiInfo = siteInfo.WifiInfo, DomainInfo = siteInfo.DomainInfo, Notes = siteNotes, }; var serverInfoVm = new ServerViewModel { Servers = serverList, CustomerId = custId }; switch (btnId) { case 1: return(PartialView("_CustomerDetails", customer)); case 2: return(PartialView("_SiteInfo", siteInfoVm)); case 3: return(PartialView("_ServerInfo", serverInfoVm)); case 4: return(PartialView("_AccountInfo", customer)); default: return(PartialView("_CustomerDetails", customer)); } }