public void IsprazniM() { using (AMIEntities entity = new AMIEntities()) { List <Merenja> agrs = entity.Merenjas.ToList <Merenja>(); Shared.Merenje agr = new Shared.Merenje(); foreach (var ag in agrs) { entity.Merenjas.Remove(ag); entity.SaveChanges(); } } }
public List <Merenje> LoadMerenja() { List <Merenje> merenje = new List <Merenje>(); using (AMIEntities entity = new AMIEntities()) { List <Merenja> ms = entity.Merenjas.ToList <Merenja>(); foreach (var m in ms) { Shared.Merenje mm = new Shared.Merenje(); switch (m.tip.ToString()) { case "ASnaga": mm.Tip = measurmentType.ASnaga; break; case "RSnaga": mm.Tip = measurmentType.RSnaga; break; case "Napon": mm.Tip = measurmentType.Napon; break; case "Struja": mm.Tip = measurmentType.Struja; break; } mm.Id = m.idMerenja; mm.Vrednost = Int32.Parse(m.vrednost); merenje.Add(mm); } }; return(merenje); }