public static int GetPay(int cityId) { AddressPay ap = new AddressPay(); AddressPayData apd = new AddressPayData(); int pay = 0; var data = apd.Get().ToList().SingleOrDefault(); if (cityId == 1 || cityId == 2 || cityId == 3 || cityId == 4 || cityId == 5 || cityId == 6 || cityId == 7) { pay = data.price1; } else if (cityId == 8 || cityId == 9 || cityId == 10 || cityId == 11) { pay = data.price2; } else if (cityId == 12 || cityId == 13 || cityId == 15 || cityId == 17 || cityId == 18) { pay = data.price3; } else if (cityId == 19 || cityId == 20 || cityId == 21) { pay = data.price4; } else if (cityId == 22 || cityId == 23 || cityId == 26 || cityId == 27 || cityId == 28 || cityId == 29) { pay = data.price5; } return pay; }
public ActionResult Edited(AddressPay addresspay) { apd.Update(addresspay); return RedirectToAction("Read"); }