C# - Prototyping an object model to generate pages from a database -
i'm on c# web dev course, , while have decent understanding
of basic c#, have been moved onto object oriented.
i have made basic news website, articles including text, images , titles.
now c# work have been asked prototype object model allow generation of new articles (title, image, text) database.
i'm still new oop, i've been 'thrown deep end of sorts'.
the specification have been given this:
"the basis of our work articles. our articles have title, 1 or more paragraphs of text, category , image. have following categories: local news; sport.
all images have own titles, descriptions , filename. have daily-mail style sidebar “of shame” – these have sidebar items consisting of images, titles , single paragraph of text. both articles , side-bar articles need link address main article page , need able archive articles no longer displayed. home page of our site consists of current articles , sidebar, these both need ordered can display eye-catching articles first. our sports page consists of sport articles, sport sidebar , league table.
the league table consists of premier league, displaying team name, games played, goal difference , number of points teams have far season. league table should sortable prints in correct order (by points, goal difference , games played (lowest first) alphabetically)."
could either work me through steps, or provide example code me base work off?
thanks, massively in advance, i've been stuck on while now.
edit:
article class:
class article { public string title { get; set; } public image image { get; set; } public string text { get; set; } public string articlelink { get; set; } public bool isarchived { get; set; } }
}
image class:
class image { public string imgtitle { get; set; } public string imgdescription { get; set; } public string imgfilename { get; set; } }
sidebaritems class:
class sidebaritem { public string sidebartitle { get; set; } public image sidebarimg { get; set; } public string sidebartext { get; set; } public string sidearticlelink { get; set; } public bool isarchived { get; set; } }
basically, problem i'm having how display article in 'homepage' class, these articles need displayed in list; along how can create league table, thought have been dictionary lists value. may simple problem can't figure out reason..
ok here's article stuff. although sidebar items ambiguous in spec assume want demonstrate inheritance
public enum category { localnews, sport } public class article { public string id; public string title; public string body; public string imageid; public category category; public int eyecatchingness; public bool archived; } public class image { public string id; public string title; public string description; public string filename; } public abstract class sidebaritem { public string id; public category category; public string mainarticleid; } public abstract class sidebaritemimage : sidebaritem { public string imageid; } public abstract class sidebaritemtitle : sidebaritem { public string title; } public abstract class sidebaritemparagraph : sidebaritem { public string paragraph; }
Comments
Post a Comment