Advertisement
MarMar_IV

Product

Apr 19th, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.65 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace app.ORM.Models
  8. {
  9.     class Product
  10.     {
  11.         public decimal ProductID { get; private set; }
  12.         public string Title { get; set; }
  13.         public string Description { get; set; }
  14.         public DateTime Added { get; set; }
  15.         public bool AllowPublic { get; set; }
  16.         public Institution Institution { get; set; }
  17.  
  18.         public Product(string title, string description, bool allowPublic, Institution institution) : this(-1, title, description, new DateTime(), allowPublic, institution) {
  19.  
  20.         }
  21.  
  22.         public Product(string title, string description, DateTime added, bool allowPublic, Institution institution) : this(-1, title, description, added, allowPublic, institution)
  23.         {
  24.  
  25.         }
  26.  
  27.         public Product(decimal productID, string title, string description, DateTime added, bool allowPublic, Institution institution) {
  28.             this.ProductID = productID;
  29.             this.Title = title;
  30.             this.Description = description;
  31.             this.Added = added;
  32.             this.AllowPublic = allowPublic;
  33.             this.Institution = institution;
  34.         }
  35.  
  36.         private string ToString(bool debug = false)
  37.         {
  38.             if (debug)
  39.             {
  40.                 return string.Format("ProductID: {0} [{1}]", ProductID, Title);
  41.             }
  42.             else
  43.             {
  44.                 return string.Format("{0}", Title);
  45.             }
  46.         }
  47.  
  48.         public override string ToString()
  49.         {
  50.             return this.ToString();
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement