public ActionResult Edit(ReferralViewModelsEdit referralsEdit) { foreach (var item in referralsEdit.Referrals) { if (ModelState.IsValid) { if (item.count > 0) { Referral r = new Referral(); r.CountReferred = item.count; r.CenterReferralId = item.referral.Id; repoService.centerReferralRepo.Insert(r); } } } return RedirectToAction("Index"); }
public void Insert(Referral r) { db.Referrals.Add(r); db.SaveChanges(); }