public virtual AppointmentModel PrepareModel(AppointmentModel model, Appointment service, bool excludeProperties = false) { if (service != null) { //fill in model values from the entity model = model ?? service.ToModel <AppointmentModel>(); } //set default values for the new model if (service == null) { model.CreatedBy = _workContext.CurrentCustomer.Id; model.CreatedOnUtc = DateTime.UtcNow; } //prepare available department templates _baseAdminModelFactory.PrepareDepartmentTemplates(model.DepartmentListTemplates, false, null); //prepare available service templates _baseAdminModelFactory.PrepareServiceTemplates(model.ServiceListTemplates, false, null); //prepare available doctor templates _baseAdminModelFactory.PrepareDoctorTemplates(model.DoctorListTemplates, false, null); return(model); }