public ActionResult TagUntag(int id, bool ischecked, bool isordered) { var t = DbUtil.Db.FetchOrCreateTag(Util.SessionId, Util.UserPeopleId, DbUtil.TagTypeId_AddSelected); var count = t.PersonTags.Count(); var topid = ""; var tp = DbUtil.Db.TagPeople.SingleOrDefault(tt => tt.PeopleId == id && tt.Id == t.Id); if (ischecked) { if (tp != null) DbUtil.Db.TagPeople.DeleteOnSubmit(tp); } else if (tp == null) { if (count == 0 && isordered) topid = id.ToString(); tp = new TagPerson() {Id = t.Id, PeopleId = id}; DbUtil.Db.TagPeople.InsertOnSubmit(tp); } DbUtil.Db.SubmitChanges(); return Content(topid); }
private void detach_PersonTags(TagPerson entity) { this.SendPropertyChanging(); entity.Tag = null; }
private void attach_PersonTags(TagPerson entity) { this.SendPropertyChanging(); entity.Tag = this; }