private void BuyerAcceptInvitation(int invitationId) { var invitation = GetInvitationById(invitationId); if (invitation != null) { var existingAcceptedInvitation = _uow.InvitationAcceptedRepository.FindBy(x => x.InvitationId == invitationId).FirstOrDefault(); if (existingAcceptedInvitation == null) { var acceptedInvitation = new InvitationsAccepted { #if (DEBUG ) InvitationsAcceptedId = _uow.InvitationAcceptedRepository.All.Max(x => x.InvitationsAcceptedId) + 1, #endif BuyerId = invitation.BuyerId, SellerId = invitation.SellerId, BoothId = invitation.BoothId, Date = invitation.Date, InvitationId = invitation.InvitationId }; _uow.InvitationAcceptedRepository.Add(acceptedInvitation); CreateInvitationSchedule(acceptedInvitation); _uow.Save(); } } }
private void CreateInvitationSchedule(InvitationsAccepted invitationAccepted) { var existingInvitationCount =_uow.InvitationScheduleRepository.Count(x => x.BuyerId == invitationAccepted.BuyerId && x.SellerId == invitationAccepted.SellerId); if (existingInvitationCount == 0) { var newScheduledInvitation = new InvitationSchedules { #if (DEBUG ) InvitationScheduleId = _uow.InvitationScheduleRepository.All.Max(x => x.InvitationScheduleId) + 1, #endif BuyerId = invitationAccepted.BuyerId, SellerId = invitationAccepted.SellerId, BoothId = invitationAccepted.BoothId, Date = invitationAccepted.Date, InvitationId = invitationAccepted.InvitationId }; _uow.InvitationScheduleRepository.Add(newScheduledInvitation); _uow.Save(); } }
private void BuyerAcceptInvitation(int invitationId) { var invitation = GetInvitationById(invitationId); if (invitation != null) { var acceptedInvitation = new InvitationsAccepted { BuyerId = invitation.BuyerId, SellerId = invitation.SellerId, BoothId = invitation.BoothId, Date = invitation.Date, InvitationId = invitation.InvitationId }; _uow.InvitationAcceptedRepository.Add(acceptedInvitation); CreateInvitationSchedule(acceptedInvitation); _uow.Save(); } }