Mini Kabibi Habibi
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
public class Hotel {
public Hotel(string title) {
this.Title = title;
this.Rooms = new List<Room>();
this.RoomServices = new List<string>();
this.HotelServices = new List<string>();
this.VoteAdresses = new Dictionary<string, decimal>();
this.IsExclusive = false;
}
public string Title { get; set; }
public Country Country { get; set; }
public string City { get; set; }
public int Stars { get; set; }
public List<Room> Rooms { get; set; }
public List<string> RoomServices { get; set; }
public List<string> HotelServices { get; set; }
public string ImageUrl { get; set; }
public decimal Rating { get; set; }
public int VoteCounter { get; set; }
public Dictionary<string, decimal> VoteAdresses { get; set; }
public bool IsExclusive { get; set; }
public int[] DescriptionIndex { get; set; }
public string Description { get {
return string.Format("<p>{0}</p><p>{1}</p><p>{2}</p>",
Data.Instance.CommonDescriptions[DescriptionIndex[0]],
Data.Instance.HotelDescriptions[DescriptionIndex[1]],
Data.Instance.RoomDescriptions[DescriptionIndex[2]]
);
} }
public decimal MinPrice {
get { return Rooms.Min(room => room.Price); }
}
public decimal MaxPrice {
get { return Rooms.Max(room => room.Price); }
}
}
public class Room {
public Room(string type, int adults, int children, decimal price) {
this.Type = type;
this.Adults = adults;
this.Children = children;
this.Price = price;
this.Id = Guid.NewGuid().ToString();
}
public string Type { get; set; }
public int Children { get; protected set; }
public int Adults { get; protected set; }
public decimal Price { get; protected set; }
public string Id { get; set; }
}
public class Country {
public Country(string name, string imageCode, IEnumerable<string> cities, int popularity) {
this.Name = name;
this.ImageCode = imageCode;
this.Cities = cities.ToList();
this.Popularity = popularity;
}
public string Name { get; protected set; }
protected string ImageCode { get; set; }
public string ImageUrl { get { return string.Format("~/Content/Images/Flags/{0}.png", ImageCode); } }
public int Popularity { get; protected set; }
public bool IsPopular { get { return Popularity > 0; } }
public List<string> Cities { get; protected set; }
}