protected void Page_Load(object sender, EventArgs e) { try { Entities dbContext = new Entities(); Model.Operator op = new Model.Operator(); op.Username = "******"; op.Password = "******"; op.Type = "admin"; dbContext.Operators.AddObject(op); dbContext.SaveChanges(); Response.Write(op.Id.ToString()); }catch(Exception ex) { Response.Write(ex.Message); } }
/// <summary> /// Deprecated Method for adding a new object to the Operators EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToOperators(Operator @operator) { base.AddObject("Operators", @operator); }
/// <summary> /// Create a new Operator object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="username">Initial value of the Username property.</param> /// <param name="password">Initial value of the Password property.</param> /// <param name="type">Initial value of the Type property.</param> public static Operator CreateOperator(global::System.Int32 id, global::System.String username, global::System.String password, global::System.String type) { Operator @operator = new Operator(); @operator.Id = id; @operator.Username = username; @operator.Password = password; @operator.Type = type; return @operator; }