public static ProductSessionAttendance ToEntity(this ProductSessionAttendanceEditDto e) { if (e == null) { return(null); } var res = new ProductSessionAttendance(); res.Id = e.Id; res.IdSession = e.IdSession; res.Present = e.Present; res.IdCustomer = e.IdCustomer; res.CustomerFullName = e.CustomerFullName; return(res); }
private async Task AddSubscribers(Guid idProduct, Guid idSession) { var customers = await _customerService.GetProductCustomers(new BasePaginatedFilterDto() { PageSize = 200 }, idProduct); foreach (var customer in customers.Customers) { var item = new ProductSessionAttendance(); item.Id = Guid.NewGuid(); item.IdSession = idSession; item.IdCustomer = customer.Id; item.CustomerFullName = $"{customer.FullName} {customer.FiscalCode}"; _dbCtx.ProductSessionAttendances.Add(item); } await _dbCtx.SaveChangesAsync(); }