更新entityframwork列表框

时间:2016-03-19 15:59:02

标签: c#

我一直在制作我的应用程序,我的应用程序只是实体框架中的crud,下面是我的方法

  public AlarmModel getMakeAlarmModel(){
                SessionService sessionService = new SessionService();
                DayService dayService = new DayService();
                AlarmModel model = new AlarmModel();


                model.sessionId =  sessionService.getSessionId(SessionList.Text); // listbox
                model.session = sessionService.getSession(SessionList.Text);  // listbox

                model.dayId = dayService.getDayId(DayList.Text);  //listbox
                model.day = dayService.getDay(DayList.Text); //listbox


                model.keterangan = information.Text;
                model.path = path.Text;
                model.totalBunyi = int.Parse(RepeatTime.Text);
                model.time = this.getMakeTime(hourTime.Text, minuteTime.Text);
                return model;
            }

我使用该方法创建或添加到数据库 但我混淆了如何使用列表框下拉列表更新它 所以我试图创建一个像这样的``

 public AlarmModel UpdateAlarmModel()
            {
                SessionService ss = new SessionService();
                DayService ds = new DayService();
                AlarmModel model = new AlarmModel();


//below is i don't know how to do it
    // model.sessionId =  sessionService.getSessionId(SessionList.Text); // listbox
                    model.session = //sessionService.getSession(SessionList.Text);  // listbox

                   // model.dayId = dayService.getDayId(DayList.Text);  //listbox
                    //model.day = dayService.getDay(DayList.Text); //listbox

below it's easy thing for me
                information.Text = model.keterangan;
                path.Text = model.path;

 //below is i don't know how to do it
               //model.totalBunyi = int.Parse(RepeatTime.Text);
                //model.time = this.getMakeTime(hourTime.Text, minuteTime.Text);

    return model;


            }

0 个答案:

没有答案