private List<Igman.DB.DAL.Tag> SinhronyzeWithDB(List<Models.Json.Tag> list, List<Models.Json.Tag> insideList) { var lTag = new List<Igman.DB.DAL.Tag>(); using (DBBL Baza = new DBBL()) { foreach (var tag in list) { Igman.DB.DAL.Tag t = new Igman.DB.DAL.Tag(); t.Name = tag.Naziv; t.GUID = Guid.NewGuid(); lTag.Add(Baza.AddTag(t)); } } foreach (var tag in insideList) { Igman.DB.DAL.Tag t = new Igman.DB.DAL.Tag(); t.Name = tag.Naziv; t.GUID = Guid.NewGuid(); t.TagID = tag.TagID.ToInt(); lTag.Add(t); } return lTag; }
public Tag AddTag(Tag t) { string cmd = string.Format("EXEC dbo.usp_TagInsert '{0}','{1}'", t.GUID, t.Name); return context.Database.SqlQuery<Tag>(cmd).SingleOrDefault(); }