Beispiel #1
0
 public void Add(OdaDAL oda)
 {
     try
     {
         ParseOda();
         OdaList = new List <OdaDAL>();
         OdaList.Add(oda);
         using (StreamWriter sw = File.CreateText(@"C:\Users\METEHAN\Desktop\proje2-yetisyagauss-master\proje2-yetisyagauss-master\proje2-yetisyagauss\DeuCSC.Proje2.DAL\Data\Musteriler.txt"))
         {
             JsonSerializer serializer = new JsonSerializer();
             serializer.Serialize(sw, OdaList);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Beispiel #2
0
        public void Update(OdaDAL updatedOda)
        {
            try
            {
                ParseOda();
                var result = OdaList.Where(x => x.Id == updatedOda.Id).FirstOrDefault();
                result = updatedOda;

                using (StreamWriter sw = File.CreateText(@"C:\Users\METEHAN\Desktop\proje2-yetisyagauss-master\proje2-yetisyagauss-master\proje2-yetisyagauss\DeuCSC.Proje2.DAL\Data\Musteriler.txt"))
                {
                    JsonSerializer serializer = new JsonSerializer();
                    serializer.Serialize(sw, OdaList);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
 public void Update(OdaDAL oda)
 {
     try
     {
         ParseOdaFile();
         var result = OdaList.Where(x => x.Id == oda.Id).FirstOrDefault();
         OdaList.Remove(result);
         OdaList.Add(oda);
         using (StreamWriter sw = File.CreateText(@"C:\Users\Yasin\Documents\GitHub\proje2-yetisyagauss\proje2-yetisyagauss\DeuCSC.Proje2.DAL\Data\Odalar.txt"))
         {
             sw.Flush();
             JsonSerializer serializer = new JsonSerializer();
             serializer.Serialize(sw, OdaList);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
        public void Add(OdaDAL oda)
        {
            try
            {
                ParseOdaFile();
                if (OdaList == null)
                {
                    OdaList = new List <OdaDAL>();
                }

                OdaList.Add(oda);
                using (StreamWriter sw = File.CreateText(@"C:\Users\Yasin\Documents\GitHub\proje2-yetisyagauss\proje2-yetisyagauss\DeuCSC.Proje2.DAL\Data\Odalar.txt"))
                {
                    sw.Flush();
                    JsonSerializer serializer = new JsonSerializer();
                    serializer.Serialize(sw, OdaList);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
 public void Add(OdaDAL oda)
 {
 }