public UserPostViewModel() { obj = new user_post(); // TODO trick? //obj.created_at = DateTime.Now; }
public UserPostViewModel(user_post obj) { this.obj = obj; this.id = obj.id; this.user_id = obj.user_id; this.parent_post_id = obj.parent_post_id; this.title = obj.title; this.content = obj.content; this.ranking_points = obj.ranking_points; this.num_views = obj.num_views; this.is_accepted_answer = obj.is_accepted_answer; this.created_at = obj.created_at; }
private void detach_user_posts(user_post entity) { this.SendPropertyChanging(); entity.user = null; }
private void attach_user_posts(user_post entity) { this.SendPropertyChanging(); entity.user = this; }
partial void Deleteuser_post(user_post instance);
partial void Updateuser_post(user_post instance);
partial void Insertuser_post(user_post instance);
public void Delete(user_post user_post) { db.user_posts.DeleteOnSubmit(user_post); }
// Insert/Delete public void Add(user_post user_post) { db.user_posts.InsertOnSubmit(user_post); }
public void ApplyChanges(user_post toEdit) { // TODO should we set user_id here and this way? toEdit.user_id = this.user_id; toEdit.parent_post_id = this.parent_post_id; toEdit.title = this.title; toEdit.content = this.content; toEdit.ranking_points = this.ranking_points; toEdit.num_views = this.num_views; toEdit.is_accepted_answer = this.is_accepted_answer; }