public string SendEvent(tk_EventCustomers msg) { try { var category = repoEventCategory.GetNonAsync(o => o.Itbid == msg.TicketCategory); var eventName = repoEvent.GetNonAsync(o => o.Itbid == msg.EventId); if (category != null && eventName != null) { string message = SmartObject.PopulateUserBody(3); message = message.Replace("{{EventName}}", eventName.EventTitle) .Replace("{{user}}", msg.Fullname) .Replace("{{TKReference}}", msg.ReferenceNo == "" ? "" : msg.ReferenceNo) .Replace("{{ReferenceNo}}", msg.PayStackReferenceNo == "" ? "" : msg.PayStackReferenceNo) .Replace("{{EventDate}}", eventName.StartDate == null?"Unavailable": oGenericViewModel.FormatDate(eventName.StartDate)) .Replace("{{EventCategory}}", category.CategoryName) .Replace("{{EventVenue}}", eventName.EventLocation) .Replace("{{EventTime}}", eventName.EventTime) .Replace("{{ContactFullname}}", msg.Fullname == "" ? "" : msg.Fullname) .Replace("{{ContactEmail}}", msg.Email == "" ? "" : msg.Email) .Replace("{{ContactPhoneNo}}", msg.PhoneNo == "" ? "" : msg.PhoneNo) .Replace("{{Units}}", msg.NoOfPersons.ToString()) .Replace("{{Amount}}", msg.TotalAmount == null ? "No Fee" : FormattedAmount((decimal)msg.TotalAmount)); return(message); } return(null); } catch (Exception) { return(null); } }