public ActionResult Edit([Bind(Include = "ID,ReceiptNo,Payment1,PaymentDate,JobID,Reference,PaymentType,CollectedBy,CreationDate,CreatedBy,LastModifiedBy,InvoiceID,PaymentTypeID,PaymentMethodId")] PAYMENT paymentModelView) { if (ModelState.IsValid) { db.Entry(paymentModelView).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(paymentModelView)); }
public static void DeleteEnrollment(int id) { using (var db = new SchedulerEntities()) { var dbEnrollment = new Entrollments { EnrollmentId = id }; db.Entry(dbEnrollment).State = EntityState.Deleted; db.SaveChanges(); } }
public static void EditCourse(CourseViewModel course) { using (var db = new SchedulerEntities()) { var dbCourse = db.Courses.Find(course.CourseId); if (dbCourse == null) { throw new DataException( "The table Course does not contain an entry corresponding to the provided primary key"); } db.Entry(dbCourse).CurrentValues.SetValues(course); db.SaveChanges(); } }
public static void EditParticipant(ParticipantsViewModel participant) { using (var db = new SchedulerEntities()) { var dbPerson = db.Persons.Find(participant.PersonId); if (dbPerson == null) { throw new DataException( "The table Course does not contain an entry corresponding to the provided primary key"); } db.Entry(dbPerson).CurrentValues.SetValues(participant); db.SaveChanges(); } }