private void CallQFunctionFromPlateWithSuspensionBtn_Click(object sender, EventArgs e)
 {
     try
     {
         var            index        = suspensionTypeListBox.Items.IndexOf(suspensionTypeListBox.CheckedItems[0]);
         SuspensionType typeForPlate = (SuspensionType)index;
         SatelitePlateWithSuspension satelitePlate = new SatelitePlateWithSuspension(typeForPlate, double.Parse(dForPlateWithSuspensionTextBox.Text), mForPlateWithSuspensionTextBox.Text, double.Parse(pForPlateWithSuspensionTextBox.Text));
         MessageBox.Show(satelitePlate.Q().ToString());
     }
     catch (Exception ex)
     {
     }
 }
        public Task Save(SuspensionType type)
        {
            if (type.Id == 0)
            {
                _context.SuspensionTypes.Add(type);
            }
            else
            {
                _context.Entry(type).State = EntityState.Modified;
            }

            return(_context.SaveChangesAsync());
        }
        public async Task <IActionResult> Save([FromBody] SuspensionTypeModel type)
        {
            try
            {
                SuspensionType typeEntity = type.Id == 0 ? new SuspensionType() : await _repository.Get(type.Id);

                typeEntity.Id   = type.Id;
                typeEntity.Name = type.Name;
                await _repository.Save(typeEntity);

                type.Id = typeEntity.Id;
                return(Created("Add", type));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Example #4
0
 public SatelitePlateWithSuspension(SuspensionType type, double d, string material, double price) : base(d, material, price)
 {
     P = type;
 }
Example #5
0
 public Suspension(SuspensionType type, int cost, string manufacturer) : base(1, manufacturer)
 {
     _cost = cost;
     Type  = type;
 }
 private static SuspensionTypeModel Map(this SuspensionType suspensionType)
 => suspensionType switch
 {