public static IncentiveModel FromDomainModel(Incentive incentive) { return new IncentiveModel { Id = incentive.Id, DealerManpowerId = incentive.DealerManpowerId, DealerManpower = incentive.DealerManpower.Name, DealerIncentive = incentive.Dealer, VolvoIncentive = incentive.Volvo, SpecialIncentives = incentive.SpecialSchemeIncentives != null && incentive.SpecialSchemeIncentives.Any() ? incentive.SpecialSchemeIncentives.Select(SpecialIncentiveModel.FromDomainModel) : new List<SpecialIncentiveModel>() }; }
/// <summary> /// Deprecated Method for adding a new object to the Incentives EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToIncentives(Incentive incentive) { base.AddObject("Incentives", incentive); }
/// <summary> /// Create a new Incentive object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="dealer">Initial value of the Dealer property.</param> /// <param name="volvo">Initial value of the Volvo property.</param> /// <param name="objectInfo">Initial value of the ObjectInfo property.</param> /// <param name="dealerManpowerId">Initial value of the DealerManpowerId property.</param> /// <param name="monthId">Initial value of the MonthId property.</param> public static Incentive CreateIncentive(global::System.Int32 id, global::System.Double dealer, global::System.Double volvo, ObjectInfo objectInfo, global::System.Int32 dealerManpowerId, global::System.Int32 monthId) { Incentive incentive = new Incentive(); incentive.Id = id; incentive.Dealer = dealer; incentive.Volvo = volvo; incentive.ObjectInfo = StructuralObject.VerifyComplexObjectIsNotNull(objectInfo, "ObjectInfo"); incentive.DealerManpowerId = dealerManpowerId; incentive.MonthId = monthId; return incentive; }
public void UpdateIncentive(Incentive incentive) { var oldIncentive = GetIncentive(incentive.Id); oldIncentive.MonthId = incentive.MonthId; oldIncentive.DealerManpowerId = incentive.DealerManpowerId; oldIncentive.Dealer = incentive.Dealer; oldIncentive.Volvo = incentive.Volvo; incentiveRepo.SaveChanges(); }