public ActionResult Create(ReservationFee reservationfee) { if (ModelState.IsValid) { reservationfeeRepository.InsertOrUpdate(reservationfee); reservationfeeRepository.Save(); return RedirectToAction("Index"); } else { ViewBag.PossiblePlaygrounds = playgroundRepository.All; return View(); } }
public void InsertOrUpdate(ReservationFee reservationfee) { if (reservationfee.ReservationFeeId == default(int)) { // New entity context.ReservationFees.Add(reservationfee); } else { // Existing entity context.Entry(reservationfee).State = EntityState.Modified; } }