private LectureType createLectureType() { LectureType lt = new LectureType(); lt.Name = txtName.Text; return(lt); }
private void FillField(int id) { LectureTypeModel lectureTypeModel = new LectureTypeModel(); LectureType lectureType = lectureTypeModel.getLectureType(id); txtName.Text = lectureType.Name; }
protected Lecture(string title, string moduleId, LectureType lectureType, int order) { Id = LectureNewId; Title = title; ModuleId = moduleId; LectureTypeName = lectureType.Name; Order = order; }
public string InsertLectureTypes(LectureType lectureType) { try { OnlineStudyEntities db = new OnlineStudyEntities(); db.LectureType.Add(lectureType); db.SaveChanges(); return(lectureType.Name + " е упешно качена !"); } catch (Exception e) { return("Error " + e); } }
public LectureType getLectureType(int id) { try { using (OnlineStudyEntities db = new OnlineStudyEntities()) { LectureType lecture = db.LectureType.Find(id); return(lecture); } }catch (Exception) { return(null); } }
public string UpdateLectureTypes(int id, LectureType lectureType) { try { OnlineStudyEntities db = new OnlineStudyEntities(); LectureType lt = db.LectureType.Find(id); lt.Name = lectureType.Name; db.SaveChanges(); return(lectureType.Name + " е успешно редактирана !"); } catch (Exception e) { return("Error " + e); } }
protected void btnSubmit_Click(object sender, EventArgs e) { LectureTypeModel model = new LectureTypeModel(); LectureType lt = createLectureType(); if (!String.IsNullOrWhiteSpace(Request.QueryString["id"])) { int id = Convert.ToInt32(Request.QueryString["id"]); lblResult.Text = model.UpdateLectureTypes(id, lt); } else { lblResult.Text = model.InsertLectureTypes(lt); } }
public string DeleteLectureTypes(int id) { try { OnlineStudyEntities db = new OnlineStudyEntities(); LectureType lecureType = db.LectureType.Find(id); db.LectureType.Attach(lecureType); db.LectureType.Remove(lecureType); db.SaveChanges(); return(lecureType.Name + " е успешно изтрита!"); } catch (Exception e) { return("Error " + e); } }
protected MediaLecture(string title, string moduleId, LectureType lectureType, int order) : base(title, moduleId, lectureType, order) { }
public Lecture(string title, LectureType lectureType) { Title = title; this.LectureType = lectureType; }