public ActionResult SalvarModelo(ModelMotor model) { this.DataService.BeginTransaction(); if (model.ModelMotorId < 1) { Motor newMotor = new Motor(); newMotor.MotorName = model.MotorName; if (model.MotorType != "") newMotor.MotorType = model.MotorType; SaveEntity(newMotor); model.MotorId = newMotor.MotorId; } else { Motor motor = new Motor(); motor.MotorId = (int)model.MotorId; motor.MotorName = model.MotorName; motor.MotorType = model.MotorType; SaveEntity(motor); } SaveEntity(model); this.DataService.Commit(); ViewBag.Brands = this.DataService.BrandRepository.CreateQuery(Proyection.Basic).OrderBy(BrandFields.BrandName).ToList(); ViewBag.Models = new List<Model>(); return View("Nuevo",model); }
public override void SetModel(GameObject ObjectModel) { base.SetModel (ObjectModel); CharacterMotor = Model.GetComponent<ModelMotor> (); if (CharacterMotor != null) { CharacterMotor.OnReachCheckPointEvent += OnReachCheckPoint; CharacterMotor.OnReachDestinationEvent += OnReachDestination; } CharacterEventGenerator = Model.GetComponent<EventGenerator> (); if(CharacterEventGenerator != null) { CharacterEventGenerator.OnClickAndTapOnCharacterEvent += OnCharacterPointerClick; } }