using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace HeIsBad.Dbl.Models
{
/// <summary>
/// Жалоба
/// </summary>
[Table("blames")]
public class DbBlame
{
/// <summary>
/// Идентификатор
/// </summary>
[Key]
public long Id { get; set; }
/// <summary>
/// Жалоба
/// </summary>
[Required]
public string Body { get; set; }
/// <summary>
/// Дата создания
/// </summary>
public DateTime Created { get; set; }
/// <summary>
/// Электронная почта жалобщика
/// </summary>
[Required]
public string Email { get; set; }
/// <summary>
/// Причина жалобы
/// </summary>
[Required]
[ForeignKey ("Reason")]
public int ReasonId { get; set; }
public virtual DbBlameReason Reason { get; set; }
/// <summary>
/// Адрес жалобы
/// </summary>
public string BlameUri { get; set; }
/// <summary>
/// Кем создано.
/// </summary>
public long? UserId { get; set; }
/// <summary>
/// Статус жалобы
/// </summary>
[ForeignKey ("BlameStatus")]
public int StatusId { get; set; }
public virtual BlameStatus BlameStatus { get; set; }
}
}
com = con.CreateCommand();
var addMin_TB_Text = "10,77777";
var min = float.Parse(addMin_TB_Text);
var addMax_TB_Text = "20,77777";
var max = float.Parse(addMax_TB_Text);
var addCena_TB_Text = "33,3";
var cena = float.Parse(addCena_TB_Text);
var tonn = addMin_TB_Text + " - " + addMax_TB_Text;
com.CommandText = @"INSERT INTO t_stoimost (mintonn, maxtonn, tonn, cenakm)
VALUES ( @mintonn, @maxtonn, @tonn, @cenakm )";
com.Parameters.AddWithValue("@mintonn", min);
com.Parameters.AddWithValue("@maxtonn", max);
com.Parameters.AddWithValue("@tonn", tonn);
com.Parameters.AddWithValue("@cenakm", cena);
com.ExecuteNonQuery();
con.Close();
using Newtonsoft.Json;
using System.Diagnostics;
using System.IO;
namespace ConsoleApp1
{
public class NickNamePair
{
[JsonProperty("nickname")]
public string NickName { get; set; }
[JsonProperty("record")]
public int Record { get; set; }
public override string ToString()
{
return $"{NickName} {Record}";
}
}
class Program
{
static void Main(string[] args)
{
using var stream = new StreamReader("data.json");
var myJson = stream.ReadToEnd();
var realresp = JsonConvert.DeserializeObject<NickNamePair[]>(myJson);
foreach (var item in realresp)
Debug.WriteLine(item);
}
}
}