Add request function to CRUD model that sends an email - c#

I have no background in programing, but my job wants me to learn. I have built a simple .asp mvc project that is a database of movies and such. I need a request form for a movie that can be filled out and if that movie is added then the client would be sent an email. Can anyone give me an idea on how I could accomplish this task. Thank you for anyone who has time to even point me in the right direction.

It's pretty straightforward to do … you need to:
get data from form (seems you already have the form)
check with db if movie added (use Entity Framework, or some other ORM)
send email based on result (You can use services for this -- sendgrid, I think twilio does it, or you can just use an smtp client if you already have a server address) …
Search/learn for each of these individually to get your project complete.

Related

Best way to add new tag to existing registered device (FCM, Xamarin.Forms, c#)

Sorry ahead of time as I'm at work so I don't have all my code in front of me that I could post here.
I'm wanting to figure out the best way to add a new tag to an existing registered device in FCM. Basically I have a Xamarin.Forms app with push notifications implemented. The question was brought up about what happens if a user logs into the app from a different device. How would you add a new tag (or the tag associated with that user) to the device so they can receive the notifications that are associated with them while they're logged in?
I started looking at some of the rest API's in the documentation (again...sorry I don't have the link to it) and it looks like there's one API where its "create/update device registration" and it basically takes a tag(s) and the gcm registration id (I think).
My thought was that I could pull the already registered device id and use that to update the registration with a new tag using the Rest API. What does the c# code look like to pull the existing registration id?
I've been trying to use the FirebaseInstanceId.GetInstance().GetInstanceId().GetToken (pseudo from memory) but I'm not sure I'm doing it correctly.
Is this the correct approach?
I believe I found the answer to my own question in the form of Xamarin.Forms.Application.Current.Properties found here.
I tested with the approach of storing the gcm registered id (token) in the properties dictionary after the initial token creation. I then closed the app, re-opened it and verified that the token value persisted and I was able to retrieve the value so I could then use it in the API calls.

Servicestack server sent events - email application

Can anyone guide me, where to find servicestack server sent event sample code.
First I explain my issue. I have created a restful service(using servicestack framework) to pull down list of emails for inbox folder using afterlogic mailbee object(external product). Now, each time if I do a pull, it takes more time to load list of emails because I am pulling down message body too.
Now I want to send down list of message headers first in the service, and then want the message body to load, because it take more time to pull down from imap object. I see server sent event is the only option here. If someone has a better solution for this, please suggest.
Now, if I have to use servicestack server sent events, I am unable to get any sample code, which I can look upon to implement in my case.
Please ask, if there is more clarification needed in my question.
Thanks for your time.
There is a sample for your requirement.
It is called Chat (it uses SSE).
Otherwise another project called EmailContacts can help you to develop the email app.
Server Events is to enable server/push real-time communication, if you want to optimize page loads you should separate your calls into 2 Services:
Fetch absolute minimum to render page
Fetch full details on demand

Paypal C# Return Url

I have a C# MVC (using Umbraco) site that I need to submit a payment through paypal. I have setup a sandbox merchant and buyer account. I am able to submit the payment and everything is working well there. However, my site needs to know when the payment has completed successfully as I will send an email and do some database operations, and here is where I'm having the problem. I cannot get paypal to auto return to my site. I need the return URL to be:
http://localhost:56733/payment-confirmation
This is not a duplicate of this question:
Setting PayPal return URL and making it auto return?
I am using C#, not PHP. Also, I am trying to run this locally. The solutions listed on the above question DO NOT WORK. The behavior and results are the same.
I do get the screen that shows the following:
You just completed your payment. XXXX, you just completed your payment. Your transaction ID for this payment is: XXXXXXXXXXXXX.
We'll send a confirmation email to XX#XXXX.com. This transaction will appear on your statement as PAYPAL.
Go to PayPal account overview
It is not recommended to handle post-payment processing on any return URL. Even with Auto-Return enabled there is no guarantee the user will make it there, and if they don't, that code will never run and you'll end up with tasks not getting completed like you expect.
Even if you're using Express Checkout API's so that you are guaranteed to end up on your own site, it's still not wise to handle all your data updates and email stuff there because the payment could be pending. You wouldn't want to deliver any product or anything like that until the pending payment cleared.
The way to handle all of that correctly is to use Instant Payment Notification (IPN). This will be triggered regardless of whether or not the user makes it back to the return URL, and you'll get multiple IPN's for transactions where the status updates so you can handle those automatically, in real-time as well.
Take a look at the documentation for IPN, but don't let it freak you out just because there's a lot of info there. It's really nothing more than a POST of data to a listener URL that you specify. In that script, you'll receive the data just like you would a form POST. It's really a pretty simple thing to setup, and you can do all sorts of cool things with it.

Receive notification in ASP.net if table from SQL was Updated/Changed

Is it possible to get notification in my ASP.net Website from database if a table was been modified?
Example: if there is new message that come to my account. It will notify me on my website. I've tried to use ajax on this kind of feature but I want a better solution on this. AJAX is keep on requesting/communicating on the server even there is not new update on my table that why I find it not that good.
Please Help me on this problem.
What technology I should use? or please give me some related article.
Thanks!
No, it is not possible to get notification to your ASP.NET Website without an ajax request which keeps on communicating to a server in a given time interval. You can use SQL triggers to get information that your table has been updated or row has been added/deleted but to get that information too you'll need to make a request to your database server. I haven't came across any architecture in which database server automatically communicates to your web application/website until and unless a request is made by web application/website.

Alert Selected users SignalR

I am looking into an alternative solution to my jQuery and Ajax alerting feature in my MVC4 app. I have stumbled across SignalR which looks like it can solve my solution but where I hear you can broadcast to a certain client and not all, I cannot seem to find an example.
Basically all I want to know is:
On set up can the clientID be the applications UserID on login?
Are you able to broadcast to specific roles and/or a list of userID's
Are there are any examples that can help demonstrate the above?
Thanks in advance
With SignalR you can manage your own user identities. SignalR represents each user with a ConnectionId but it is ultimately up to the dev to map that to an existing user profile.
Yes, you are able to broadcast to groups or specific clients. You can add clients to groups and then send single messages to multiple people simultaneously or you can send to a specific client.
As noted in the comment JabbR is an excelent example. Also for a quick start on getting introduced to SignalR check out the Quick Start Hubs page. Lastly SignalR is open source so check out the source and the wiki.

Categories