public ActionResult Detail(int?id) { //Bool variable for the View: checking if user is venue owner or not ViewBag.IsOwner = false; //Get the current logged in user - will be implemented in the future when the log in function/ page is complete string ownerEmail = User.Identity.GetUserName(); //Check if current logged in user is the owner if (_venueOwnerService.IsVenueOwner(ownerEmail)) { ViewBag.IsOwner = true; VenueOwner owner = _venueOwnerService.GetVenueOwnerByEmail(ownerEmail); //Create the view model using values of the owner if not null CreateVenueOwnerViewModel model = new CreateVenueOwnerViewModel() { VenueOwnerId = owner.VenueOwnerId, FirstName = owner.FirstName, LastName = owner.LastName, Email = owner.Email, PhoneNumber = owner.Phone, CompanyName = owner.CompanyName, SignUpDate = owner.SignUpDate, VenueName = _venueService.GetVenueNameById(owner.VenueId), VenueId = owner.VenueId }; //Return it back to the view return(View(model)); } else { ViewBag.IsOwner = false; VenueOwner owner = _venueOwnerService.GetVenueOwnerById((int)id); CreateVenueOwnerViewModel model = new CreateVenueOwnerViewModel() { VenueOwnerId = owner.VenueOwnerId, FirstName = owner.FirstName, LastName = owner.LastName, Email = owner.Email, PhoneNumber = owner.Phone, CompanyName = owner.CompanyName, SignUpDate = owner.SignUpDate, VenueName = _venueService.GetVenueNameById(owner.VenueId), VenueId = owner.VenueId }; return(View(model)); } }
public void SendMessage(Game game, int playerId, string body, string subject) { //Initializing Message Details string sendingToEmail = ""; string messageContent = ""; //Either sending the message to the Creator of the game or the Players in the game if (game.ContactId == playerId) { sendingToEmail = _contactService.GetContactById((int)game.ContactId).Email; messageContent = body; } else { if (_contactService.GetContactById(playerId) != null) { //emailing to the players on the game list sendingToEmail = _contactService.GetContactById(playerId).Email; } else { //email to the venue owner sendingToEmail = _venueOwnerService.GetVenueOwnerById(playerId).Email; } messageContent = body; } MailMessage mailMessage = new MailMessage(_gMailer.GetEmailAddress(), sendingToEmail) { Body = messageContent, Subject = subject }; //Send the Message _gMailer.Send(mailMessage); }