public int AddUpdateStudentInvoice(StudentInvoice student) { if (student.ID == 0) { student.CreatedDate = DateTime.Now; HIQAdminContext.StudentInvoices.Add(student); } else { var invoice = HIQAdminContext.StudentInvoices.FirstOrDefault(x => x.ID == student.ID); if (invoice != null) { invoice.Name = student.Name; invoice.PaymentMode = student.PaymentMode; invoice.PaymentStatus = student.PaymentStatus; invoice.Mobile = student.Mobile; invoice.Status = student.Status; invoice.SubTotal = student.SubTotal; invoice.ModifiedDate = DateTime.Now; HIQAdminContext.Entry(invoice).State = EntityState.Modified; } } return(HIQAdminContext.SaveChanges() > 0 ? student.UserID : 0); }
public int AddUpdateStudentInvoice(StudentInvoiceDTO student) { StudentInvoice S = mapper.Map <StudentInvoice>(student); return(StudentRepository.AddUpdateStudentInvoice(S)); }