public static void ProductCreateTag(int id, string keyword) { string[] Mang = keyword.Split(','); for (int i = 0; i < Mang.Length; i++) { string name = Mang[i]; if (name != null && name != "") { string kiemtra = Mang[i].Substring(0, 1); if (kiemtra == " ") { name = Mang[i].Remove(0, 1); } tblProductTag productTag = new tblProductTag(); productTag.idp = id; productTag.Name = name; productTag.Tag = NameToTag(name); db.tblProductTags.Add(productTag); db.SaveChanges(); } } }
public static void UpdateHistory(string task, string FullName, string UserID) { ViglaceraContext db = new ViglaceraContext(); tblHistoryLogin tblhistorylogin = new tblHistoryLogin(); tblhistorylogin.FullName = FullName; tblhistorylogin.Task = task; tblhistorylogin.idUser = int.Parse(UserID); tblhistorylogin.DateCreate = DateTime.Now; tblhistorylogin.Active = true; db.tblHistoryLogins.Add(tblhistorylogin); db.SaveChanges(); }