buypeeb-cs/Listing.cs

48 lines
1000 B
C#

using System;
using System.Globalization;
namespace Buypeeb {
class Listing {
public string url { get; set; }
public string id { get; set; }
public string name { get; set; }
public int price = 0;
public int win_price;
public string original_name;
public bool favourite { get; set; } = false;
// start_date, end_date
public int bids;
public bool auto_extension;
public bool ready;
public Listing(string url, string id, string name) {
this.url = url;
this.id = id;
this.name = name;
this.ready = false;
}
public Listing() {
// parameterless constructur for deserialisation
}
public void Update() {
// use fake values for now
var rnd = new Random();
this.price = rnd.Next(100, 5000);
this.bids = rnd.Next(0, 15);
this.name = "testing";
this.original_name = "testing";
}
public string PriceAUD() {
double aud = this.price / 75.0;
return $"${aud:f2}";
}
public string PriceJPY() {
return $"¥{this.price}";
}
}
}