Exemplo n.º 1
0
        public void save_rating(int?Rating)
        {
            int previous_id = 0;

            using (ConverterDataEntities context = new ConverterDataEntities())
            {
                previous_id = context.Ratings
                              .Count();

                var previous_rating = context.Ratings.First(c => c.id >= 0);
                context.Ratings.Remove(previous_rating);
                context.SaveChanges();

                Rating newSave = new Rating()
                {
                    Rating1 = Rating
                };
                context.Ratings.Add(newSave);
                context.SaveChanges();
            }
        }
Exemplo n.º 2
0
 public void save_to_DB(string Converter, string UnitFrom, string UnitTo, string ValueToConvert, string ConvertedValue, DateTime Date)
 {
     using (ConverterDataEntities context = new ConverterDataEntities())
     {
         Converter_Saves newSave = new Converter_Saves()
         {
             Converter      = Converter,
             UnitFrom       = UnitFrom,
             UnitTo         = UnitTo,
             ValueToConvert = ValueToConvert,
             ConvertedValue = ConvertedValue,
             DateTime       = Date
         };
         context.Converter_Saves.Add(newSave);
         context.SaveChanges();
     }
 }