private bool Save() { bool result = false; using (var ctx = new EF6.RT2020Entities()) { var item = ctx.SmartTag4Member.Find(_SmartTagId); if (item == null) { item = new EF6.SmartTag4Member(); item.TagId = Guid.NewGuid(); item.TagCode = txtTagCode.Text; ctx.SmartTag4Member.Add(item); } item.TagName = txtTagName.Text; item.TagName_Chs = txtTagNameAlt1.Text; item.TagName_Cht = txtTagNameAlt2.Text; item.Priority = Convert.ToInt32(txtPriority.Text); ctx.SaveChanges(); result = true; } return(result); }
/// <summary> /// Get a EF6.SmartTag4Member object from the database using the given TagId /// </summary> /// <param name="tagId">The primary key value</param> /// <returns>A EF6.SmartTag4Member object</returns> public static EF6.SmartTag4Member Get(Guid tagId) { EF6.SmartTag4Member result = null; using (var ctx = new EF6.RT2020Entities()) { result = ctx.SmartTag4Member.Where(x => x.TagId == tagId).AsNoTracking().FirstOrDefault(); } return(result); }
public static EF6.SmartTag4Member GetByTagCode(string code) { EF6.SmartTag4Member result = null; using (var ctx = new EF6.RT2020Entities()) { result = ctx.SmartTag4Member.Where(x => x.TagCode == code).FirstOrDefault(); } return(result); }
/// <summary> /// Get a EF6.SmartTag4Member object from the database using the given QueryString /// </summary> /// <param name="tagId">The primary key value</param> /// <returns>A EF6.SmartTag4Member object</returns> public static EF6.SmartTag4Member Get(string whereClause) { EF6.SmartTag4Member result = null; using (var ctx = new EF6.RT2020Entities()) { result = ctx.SmartTag4Member .SqlQuery(string.Format("Select * from SmartTag4Member Where {0}", whereClause)) .AsNoTracking() .FirstOrDefault(); } return(result); }