public static ComponentFormViewModel MapToComponentConstantViewModel(this ComponentConstant model) { return(new ComponentFormViewModel() { Id = model.Id, DFIndicatorId = model.DFIndicatorId, DFSourceId = model.DFSourceId, DFYearFiscalId = model.DFYearFiscalId, DFUnitId = model.DFUnitId, DFQuarterId = model.DFQuarterId, IsDeleted = model.IsDeleted, ExportsOfGoodsAndServices = model.ExportsOfGoodsAndServices, GovernmentConsumption = model.GovernmentConsumption, GrossCapitalFormation = model.GrossCapitalFormation, ImportsOfGoodsAndServices = model.ImportsOfGoodsAndServices, PrivateConsumption = model.PrivateConsumption, TotalGrossDomesticProductAtMarketPrices = model.TotalGrossDomesticProductAtMarketPrices, ComponentId = model.Id, }); }
/// <summary> /// add new component constatnt /// </summary> /// <param name="componentConstant"></param> public void Add(ComponentConstant component) { _db.ComponentConstants.Add(component); _db.SaveChanges(); }
/// <summary> /// update constant component /// </summary> /// <param name="component"></param> public void Update(ComponentConstant component) { _db.ComponentConstants.Attach(component); _db.Entry(component).State = EntityState.Modified; _db.SaveChanges(); }