Razor is a syntax used to build web pages within ASP.NET applications. In essence it’s a mix of Razor specific markup, C# (or VB) and HTML code. In this guide I’m going to introduce you to Razor syntax, explain how it works and show you some other related stuff.
It’s worth noting that Razor syntax is pretty simple. Visual Studio has syntax highlighting for it as well as it supports Razor intellisense.
Testing webhooks on localhost
During one of my projects I was implementing payments using Stripe and PayPal. I had to test webhooks in order to confirm subscriptions (recurring payments) periodically. Since I was developing locally my app could not receive requests. In this post I’m going to show you how you can test remote webhook callback from 3rd party apps in your local app.
Webhooks theory The theory is simple, you create a payment transaction (or any other supported event) in Stripe/PayPal/whatever, then you receive a request, which is sent by 3rd party software.
ASP.NET Core ajax modals with validation using Bootstrap (Part 2)
In the second part of this tutorial we’ll add more ajax powered functionality to modals. You’re going to learn how to:
upload files via ajax
display notifications after modal data has been saved
view stored data in a table
ajax reload table after modal data has been saved
make sure that the modal opens when button is dynamically generated
First part of this tutorial can be found here.
jQuery ajax file upload
Do you know why you cannot send files via $.post? Maybe you don’t event know how you should start sending files? In this post you’re going to learn how to send files via ajax requests. I’m not going to show you how to implement server-side code, it’s up to you.
Preparation Let’s start by preparing simple HTML form:
1 2 3 4 <form enctype="multipart/form-data" action="/Upload" method="post"> <input name="Picture" type="file"> <button type="submit">Send!
Parsing floating point numbers
One of my StackOverflow answers is about converting string to double. I answered the question long time ago, but it still gets me some upvotes. It looks like this topic requires some more attention. In this post I’m going to show you about possible pitfalls of parsing float/double numbers. You’re also going to learn how to safely convert string to float and string to double.
This post is language agnostic, meaning that the concepts do not depend on specific language.
Making things invisible in CSS
This post will teach you the 3 ways to make elements invisible in CSS. Each one behaves differently and has it own use case. Let me introduce you to the display, visiblity and opacity properties.
CSS display property Every element on a page is a box (rectangle). Display specifies behavior of this box and how to renders on page. There are many values that can be used (full list here), but there are just a few commonly used, e.
ASP.NET Core routing introduction
This article will introduce you to the concept of routing in ASP.NET Core framework.
What is routing? Simply said routing is a process of mapping URLs to controllers and actions. If you’ve ever wondered how does your app “know” that /Home/Index request should be handled by HomeController.Index method then routing is the answer.
You can make special routes, which allow you to provide additional parameters as a part of url. A common example is an “id”.
Entity Framework Core Snapshot
In this article you’re going to learn what is a mysterious <DBName>Snapshot.cs file in your solution. I’m going to teach you why snapshot file exists and how it relates to migrations.
Introduction to migrations You create new app which requires a database. But you change the model (classes) often so every time you change your model (e.g. you add new column) you need to update your database schema. It’s a lot of work, but there’s a way to automate it.
Learn/Teach LINQ using TDD/TDL
Long time ago I’ve created a project which purpose is to teach LINQ using tests. Technically it’s not exacly TDD. I’d rather call it TDL (test-driven learning), an “invention” of my own ;)
Before we start let me point you to source code located on my GitHub repository.
Learning LINQ The basics of LINQ are fairly easy. We have to learn how to filter, sort and project data. It can be used in two ways: the method syntax and the query syntax.
ASP.NET Core ajax modals with validation using Bootstrap
In this tutorial I’m going to show you how to load modals dynamically and how to process forms (within modals) via ajax requests.
I’m going to use Bootstrap for modals, because it’s pretty popular, but you may as well use any other UI framework or library for displaying modals.
We’ll use jQuery to send ajax and perform modal actions.
For the backend, we’ll use .NET Core MVC, but you can replace it with your technology of choice.