public static ComponentFormViewModel MapToComponentCurrentViewModel(this ComponentCurrent 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 current /// </summary> /// <param name="component"></param> public void Add(ComponentCurrent component) { _db.ComponentCurrents.Add(component); _db.SaveChanges(); }
/// <summary> /// update current component /// </summary> /// <param name="component"></param> public void Update(ComponentCurrent component) { _db.ComponentCurrents.Attach(component); _db.Entry(component).State = EntityState.Modified; _db.SaveChanges(); }