public SiteInfoModel(Site site) { if(site!=null) { _name = site.SiteName; _title = site.SiteTitle; _description = site.Description; } }
public ManageSiteModel(Site site) { if(site!=null) { Active = site.Active; Name = site.SiteName; Title = site.SiteTitle; Description = site.Description; SiteType = (SiteType)site.SiteType; } }
public ActionResult Manage(HttpPostedFileBase imageFile, ManageSiteModel manageSiteModel) { if (ModelState.IsValid) { if (imageFile != null) { byte[] logo = new byte[imageFile.ContentLength]; imageFile.InputStream.Read(logo, 0, imageFile.ContentLength); using (AnonoMightEntities anonoMightEntities = new AnonoMightEntities()) { Site site = anonoMightEntities.Sites.SingleOrDefault(o => o.SiteName == manageSiteModel.Name); if (site == null) { site = new Site(); anonoMightEntities.Sites.Add(site); site.SiteName = manageSiteModel.Name; if (manageSiteModel.SiteType == SiteType.Definitions) anonoMightEntities.CreateDefinitionsTable(site.SiteName); else if (manageSiteModel.SiteType == SiteType.FacebookProfiles) anonoMightEntities.CreateFacebookProfilesTable(site.SiteName); else if (manageSiteModel.SiteType == SiteType.ImagePosts) anonoMightEntities.CreateImagePostsTable(site.SiteName); else if (manageSiteModel.SiteType == SiteType.Tweets) anonoMightEntities.CreateTweetsTable(site.SiteName); } site.SiteLogo = logo; site.SiteTitle = manageSiteModel.Title; site.SiteType = (byte)manageSiteModel.SiteType; site.Active = manageSiteModel.Active; site.Description = manageSiteModel.Description; anonoMightEntities.SaveChanges(); } ViewBag.Message = "Site has been saved!"; } else { ViewBag.Message = "No Image Selected!"; } } return View(manageSiteModel); }
public FacebookLinkModel(Site site, IQueryable<FacebookProfile> tweets, FacebookProfile topProfile, int page) { SiteInfo = new SiteInfoModel(site); ContentList = new PagedList<FacebookProfile>(tweets.OrderByDescending(x => x.TimeStamp), page, 10); TopProfile = topProfile; }
public TweetModel(Site site, IQueryable<Tweet> tweets,int page) { SiteInfo = new SiteInfoModel(site); ContentList = new PagedList<Tweet>(tweets.OrderByDescending(x => x.TimeStamp), page, 10); }