(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,}
^\w+([.-]?\w+)@\w+([.-]?\w+)(.\w{1,})+$
-- Dolati = 1, | |
-- PayamNour = 2, | |
-- Elmi_Karbordi = 3, | |
-- GheirEntefaee = 4, | |
-- Azad = 5, | |
-- Fani = 6 | |
insert into universities (name, type) | |
SELECT N'دانشکده فنی و حرفهای پسران قزوین (شهیدبابایی)' as name ,6 as type | |
UNION ALL SELECT N'دانشکده فنی شهید بهشتی کرج' as name ,6 as type |
public class City: Entity<Guid> | |
{ | |
public string Name { get; set; } | |
public Guid ProvinceId { get; set; } | |
public Province Province { get; set; } | |
public double Lat { get; set; } | |
public double Long { get; set; } | |
} | |
public class Province: Entity<Guid> |
public static class MimeTypeMap | |
{ | |
private static readonly Lazy<IDictionary<string, string>> _mappings = new Lazy<IDictionary<string, string>>(BuildMappings); | |
private static IDictionary<string, string> BuildMappings() | |
{ | |
var mappings = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { | |
#region Big freaking list of mime types | |
public class FilesController: BistoonControllerBase | |
{ | |
[HttpPost, DisableRequestSizeLimit] | |
public IActionResult Upload() | |
{ | |
try | |
{ | |
var file = Request.Form.Files[0]; | |
var folderName = Path.Combine("UploadedFiles"); | |
var pathToSave = $"c:\\{folderName}"; |
<?xml version="1.0" encoding="utf-8" ?> | |
<localizationDictionary culture="en"> | |
<texts> | |
<text name="HomePage" value="صفحه نخست" /> | |
<text name="About" value="درباره" /> | |
<text name="WelcomeMessage" value="به ایران استارتآپ خوش آمدید!" /> | |
<text name="FormIsNotValidMessage" value="فرم معتبر نیست. لطفا خطاها را بررسی و رفع کنید." /> | |
<text name="TenantNameCanNotBeEmpty" value="Tenant name can not be empty" /> | |
<text name="InvalidUserNameOrPassword" value="نام کاربری یا رمز ورود نامعتبر است" /> | |
<text name="ThereIsNoTenantDefinedWithName{0}" value="There is no tenant defined with name {0}" /> |
(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,}
^\w+([.-]?\w+)@\w+([.-]?\w+)(.\w{1,})+$
HttpClient httpClient = new HttpClient(); | |
MultipartFormDataContent form = new MultipartFormDataContent(); | |
form.Add(new StringContent(username), "username"); | |
form.Add(new StringContent(useremail), "email"); | |
form.Add(new StringContent(password), "password"); | |
form.Add(new ByteArrayContent(file_bytes, 0, file_bytes.Length), "profile_pic", "hello1.jpg"); | |
HttpResponseMessage response = await httpClient.PostAsync("PostUrl", form); | |
response.EnsureSuccessStatusCode(); |
public static class SecurityHelper | |
{ | |
public static string MD5Hash(string input) | |
{ | |
StringBuilder hash = new StringBuilder(); | |
MD5CryptoServiceProvider md5provider = new MD5CryptoServiceProvider(); | |
byte[] bytes = md5provider.ComputeHash(new UTF8Encoding().GetBytes(input)); | |
for (int i = 0; i < bytes.Length; i++) | |
{ |
public static class HttpHelper | |
{ | |
public static async Task Post<T>(string baseUrl, string url, T contentValue) | |
{ | |
using (var client = new HttpClient()) | |
{ | |
client.BaseAddress = new Uri(baseUrl); | |
var content = new StringContent(JsonConvert.SerializeObject(contentValue), Encoding.UTF8, "application/json"); | |
var result = await client.PostAsync(url, content); |
/* Drop all non-system stored procs */ | |
DECLARE @name VARCHAR(128) | |
DECLARE @SQL VARCHAR(254) | |
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'P' AND category = 0 ORDER BY [name]) | |
WHILE @name is not null | |
BEGIN | |
SELECT @SQL = 'DROP PROCEDURE [dbo].[' + RTRIM(@name) +']' | |
EXEC (@SQL) |