Beispiel #1
0
        public bool InactivateGenerator(FishGenerator item)
        {
            bool result = false;

            try
            {
                using (RCID_DWHEntities context = new RCID_DWHEntities())
                {
                    Fish_Generator efItem = context.Fish_Generator.Where(b => b.GeneratorID == item.GeneratorID).FirstOrDefault();

                    if (efItem == null)
                    {
                        return(result);
                    }

                    efItem.GeneratorActive = false;

                    if (context.SaveChanges() > 0)
                    {
                        result = true;
                    }
                }
            }
            catch (Exception) { }
            return(result);
        }
Beispiel #2
0
        public bool CreateGenerator(FishGenerator item)
        {
            bool result = false;

            try
            {
                using (RCID_DWHEntities context = new RCID_DWHEntities())
                {
                    byte newid = context.Fish_Generator.OrderByDescending(u => u.GeneratorID).FirstOrDefault().GeneratorID;
                    newid++;

                    Fish_Generator efItem = new Fish_Generator()
                    {
                        GeneratorID     = newid,
                        GeneratorActive = true,
                        GeneratorName   = item.GeneratorName
                    };

                    context.Fish_Generator.Add(efItem);

                    if (context.SaveChanges() > 0)
                    {
                        result = true;
                    }
                }
            }
            catch (Exception e) { throw e; }
            return(result);
        }