public ActionResult EditRates(MeatRatesViewModel meatRatesViewModel) { var rates = _meatRateContext.MeatRates.ToList(); var selectedRate = rates.Single(c => c.MeatKindId == meatRatesViewModel.MeatKind.Id); selectedRate.CostPerLbBoneless = meatRatesViewModel.MeatRates.CostPerLbBoneless; selectedRate.CostPerLb = meatRatesViewModel.MeatRates.CostPerLb; _meatRateContext.SaveChanges(); return(RedirectToAction("RateCard")); }
public ActionResult RateCard() { var TypesOfMeatRates = _meatRateContext.MeatRates.ToList(); var TypesOfMeats = _meatRateContext.MeatKind.ToList(); var TypesOfMeatDetails = new MeatRatesViewModel { MeatKindList = TypesOfMeats, MeatRatesList = TypesOfMeatRates }; return(View(TypesOfMeatDetails)); }