public string Save() { string error = string.Empty; try { using (SQLDatabaseDataContext db = new SQLDatabaseDataContext(Program.Connectionstring)) { ЕducationaLevel educationLevel = new ЕducationaLevel(); if (this.ID > 0) { educationLevel = (from edu in db.ЕducationaLevels where edu.ID == this.ID select edu).FirstOrDefault(); } educationLevel.LevelName = this.LevelName; if (this.ID == 0) { db.ЕducationaLevels.InsertOnSubmit(educationLevel); } db.SubmitChanges(); } } catch (Exception ex) { error = ex.Message; } return(error); }
public TEducationLevel(ЕducationaLevel el) { this.ID = el.ID; this.LevelName = el.LevelName; }