public async Task <Student> CreateAsync(Student student) { if (student == null) { throw new ArgumentNullException(nameof(student)); } _ctxt.Set <Student>().Add(student); student.DateCreated = DateTime.UtcNow; student.CreatedBy = student?.CreatedBy ?? "System Ingestion"; await _ctxt.SaveChangesAsync(); _logr.Information("The following student has been added {@Student}", student); return(student); }
public async Task <Course> CreateAsync(Course course) { if (course == null) { throw new ArgumentNullException(nameof(course)); } _ctxt.Set <Course>().Add(course); course.DateCreated = DateTime.UtcNow; course.CreatedBy = course?.CreatedBy ?? "System Ingestion"; await _ctxt.SaveChangesAsync(); _logr.Information("The following course has been added {@Course}", course); return(course); }
public async Task <Customer> CreateAsync(Customer customer) { if (customer == null) { throw new ArgumentNullException(nameof(customer)); } _ctxt.Set <Customer>().Add(customer); customer.DateCreated = DateTime.UtcNow; customer.CreatedBy = customer?.CreatedBy ?? "System Ingestion"; await _ctxt.SaveChangesAsync(); _logr.Information("The following customer has been added {@Customer}", customer); return(customer); }