Пример #1
0
        public async Task <BookLogForCreateUpdateReturnModel> BookLog_Set(BookLogForCreateModel model, string uri)
        {
            var result = await _repo.BookLog_Set(model);

            var emailRecipients = await _emails.EmailRecipientList_Get();


            if (result != null)
            {
                if (model.BookingTypeID == 3)
                {
                    if (model.AmenityID == 3 || model.AmenityID == 4)
                    {
                        foreach (var recipient in emailRecipients)
                        {
                            result.Recipient = recipient;
                            await _send.SendEmail(_send.BookLogForEmailParam(result, "Add-Admin-Booking-Template", uri, true));
                        }
                        await _send.SendEmail(_send.BookLogForEmailParam(result, "Confirm-Booking-Conference-Template", uri, false));
                    }
                    else
                    {
                        foreach (var recipient in emailRecipients)
                        {
                            result.Recipient = recipient;
                            await _send.SendEmail(_send.BookLogForEmailParam(result, "Add-Admin-Booking-Template", uri, true));
                        }
                        await _send.SendEmail(_send.BookLogForEmailParam(result, "Confirm-Booking-Template", uri, false));
                    }
                }
            }

            var modelForReturn = _mapper.Map <BookLogForCreateUpdateReturnModel>(result);

            return(modelForReturn);
        }