Cot stfr dltlifu

Một phần của tài liệu Xây dựng hệ quản trị nội dung sử dụng ASP Net MVC 4.PDF (Trang 59 - 62)

CM. thuyien cam chi& rem as

43. Quin It binh

4.4.1. Cot stfr dltlifu

Vdi chirc nting nay to can hai bing, mat li bang Polls china cic ciu hdi lily y kian vi cic thudc tut dui chin nhir cau hdi lay Sr lain la hien hanh hay di lay di) y hen.

Bing did hai la PollOptions china th8ng tin ye nhttng Iva chon cho ciu hdi dat ra da lay t kik hai lira chop Wong dug vdi melt cau tri lei duct ha thing at ra cho ngubi ding. Quan hi gills hai bang ay thong qua khda ngoai

4.4.2. Model

Ruing trng vdri cic bin Polls vi PollOptions dugc sir dung, Entity Framework to shill ra cic l8p Poll vi PollOption tuanglIng di toong tic voi co set dg lieu:

Ldp Poll:

public partial class Poll

{

public Poll()

{

this.Polloptions . new washset<Polloption>();

}

public int Pollid { get; set; }

public Nullable<System.DateTime> AddedDate { get; set; } public Nullable<int> AddedBy { get; set; }

public string QuestionText { get; set; } public Nullable<int> Status { get; set; }

public virtual ICollection<PollOption> PollOptions { get; set; } public virtual member member { get; set; }

fly dyng chdr Wing

Lap PollOption:

public partial class PollOption

{

public int OptionId { get; set; }

public Nullable<System.DateTime> AddedDate { get; set; } public Nullable<int> AddedBy { get; set; }

public Nullable<int> Pollid get; set; } public string OptionText { get; set; } public Nullable<int> Votes get; set; } public virtual Poll Poll get; set; } public virtual member member { get; set; }

}

4.4.3. Controller

Tuang ung yeti the chin nAng to co cgc phuang tittle sau:

Vievdisto PollsController Admin --

ViewPoll0 PollController -- int id

TimICiemo PollController Admin string keyword

AddPollo PollController Admin ---

[HttpPost]

AddPoll0 PollController Admin

FormCollection collection, Poll p

ChinhSuao PollController Admin int id

[HttpPost]

ChinhSua0 PollController Admin

FormCollection collection, int id

DuYeto PollOmMtoller Admin int id

DeleteO PollController Admin int id

[HttpPost]

AddPollOption0 PollController Admin

FormCollection collection, PollOption po [HttpPost] UpdateOption° PollController Mtn FormCollection collection Trang 68/85

My dyng chat ning [HttpPost] AddVote() PollController FormCollection collection 4.4.4. View

ViewList.cshtml View My dung de hien danh sach St ci the du hal Ichito sit co ten he thong, bao gem

ci nhting du hei hien &tub vi cau hiti di thu du jr hen.

PollsNiewList

AddPoll.cshtml View nay duqc win tr{ vien dung de them du hoi tham do meri.

Polls/AddPoll

ChinhSua.cshtml View My duqc quart tri vien &Mg de chinh salt cau Wu cling nit*: cac phuung in lira chon cho du hal do. Ti view My cling co the them hi* zee tic lira chqn elk du Mi.

Polls/ChinhSua/{id}

TimKiem.cshtml View nay tra ye danh sfich cic du WA tim duqc.

Polls/TimICiem?keyword ={keyword}

ViewPoll.cshtml View My hien thi ciu hesi vi de phuong in lva chon curt du hei do. Tai view My ngutri thing co the chip cac phucmg an cita mirth vi Lac nh$n len he thong.

fur m be r

Caw Name Data Type Mow MS

P9 ht therNarne nclur(15) Password nverchar(50) Email nvarcer(100) Ea Oludfu kit Status kit HoVaTen nvercr(100) POWS* dale Gioranh est DiaCti Mod Ig SW nverdisr(20) E?) 0

fly ding chit ning

Một phần của tài liệu Xây dựng hệ quản trị nội dung sử dụng ASP Net MVC 4.PDF (Trang 59 - 62)

Tải bản đầy đủ (PDF)

(76 trang)