Exemple #1
0
        public Gyroscope UpdateGyroscope(UpdateGyroscope updateGyroscope)
        {
            if (updateGyroscope.PlateId != null)
            {
                updateGyroscope.Plate = _plateRepository.GetPlate(updateGyroscope.PlateId);
            }

            return(_gyroscopeRepository.UpdateGyroscope(updateGyroscope));
        }
        public Gyroscope UpdateGyroscope(UpdateGyroscope updateGyroscope)
        {
            var gyroscope = _context.Gyroscopes.Where(a => a.Id.Equals(updateGyroscope.Id)).SingleOrDefault();

            // var gyroscope = _context.Gyroscopes.Where(a =>l ids.Contains(a.Id)).ToList();
            if (gyroscope is null)
            {
                throw new Exception("");
            }

            if (updateGyroscope.AssemblyMms != null)
            {
                gyroscope.AssemblyMms = updateGyroscope.AssemblyMms;
            }
            if (updateGyroscope.Plate != null)
            {
                gyroscope.Plate = updateGyroscope.Plate;
            }

            if (updateGyroscope.ParameterF1.HasValue)
            {
                gyroscope.ParameterF1 = updateGyroscope.ParameterF1.Value;
            }
            if (updateGyroscope.ParameterF2.HasValue)
            {
                gyroscope.ParameterF2 = updateGyroscope.ParameterF2.Value;
            }
            if (updateGyroscope.ParameterQ1.HasValue)
            {
                gyroscope.ParameterQ1 = updateGyroscope.ParameterQ1.Value;
            }
            if (updateGyroscope.ParameterQ2.HasValue)
            {
                gyroscope.ParameterQ2 = updateGyroscope.ParameterQ2.Value;
            }
            if (updateGyroscope.ParameterQ.HasValue)
            {
                gyroscope.ParameterQ = updateGyroscope.ParameterQ.Value;
            }
            if (updateGyroscope.DifferentialF.HasValue)
            {
                gyroscope.DifferentialF = updateGyroscope.DifferentialF.Value;
            }
            if (updateGyroscope.DifferentialFQ.HasValue)
            {
                gyroscope.DifferentialFQ = updateGyroscope.DifferentialFQ.Value;
            }

            _context.SaveChanges();

            return(gyroscope);
        }
 public Gyroscope UpdateGyroscope(UpdateGyroscope gyroscope)
 {
     return(_gyroscopeService.UpdateGyroscope(gyroscope));
 }