public void View_UpdateStatus(object sender, ChangeLectureStatusEventArgs e) { var lecture = this.lectureService.FindById(e.LectureId); var selectedStatus = (LectureStatus)Enum.Parse(typeof(LectureStatus), e.LectureStatus); lecture.Status = selectedStatus; try { this.lectureService.Save(); } catch (Exception ex) { this.View.Model.IsSuccess = false; this.View.Model.ErrorMessage = "Something`s wrong."; return; } this.View.Model.IsSuccess = true; }
public void LecturesGridView_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = (GridViewRow)this.LecturesGridView.Rows[e.RowIndex]; RadioButtonList buttons = (RadioButtonList)row.FindControl("StatusChange"); var status = buttons.SelectedValue; var lectureId = buttons.Attributes["data-id"]; if (status != null && status != "") { var ev = new ChangeLectureStatusEventArgs(lectureId, status); this.UpdateStatus?.Invoke(sender, ev); if (this.Model.IsSuccess) { this.MessageContainer.ClearAll(); this.LecturesGridView_RowCancelingEdit(null, null); } else { this.MessageContainer.ShowError(this.Model.ErrorMessage); } } }