Advertisement
Mihailo21

Lek.cs

Apr 19th, 2024
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 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. using System.Runtime.Serialization;
  7.  
  8. namespace Common
  9. {
  10.     [DataContract]
  11.  
  12.     public class Lek
  13.     {
  14.         public Lek()
  15.         {
  16.             Id = 0;
  17.             Ime = "ime";
  18.             Kolicina = 0;
  19.             Sastojci = new List<string>();
  20.  
  21.         }
  22.  
  23.         public Lek(int id, string ime, int kolicina, List<string> sastojci)
  24.         {
  25.             Id = id;
  26.             Ime = ime;
  27.             Kolicina = kolicina;
  28.             Sastojci = sastojci;
  29.         }
  30.  
  31.         [DataMember]
  32.         public int Id { get; set; }
  33.         [DataMember]
  34.         public string Ime { get; set; }
  35.         [DataMember]
  36.         public int Kolicina { get; set; }
  37.         [DataMember]
  38.         public List<string> Sastojci {  get; set; }
  39.  
  40.         public override string ToString()
  41.         {
  42.             string ret = $"ID: {Id}, IME: {Ime}, KOLICINA: {Kolicina}, SASTOJCI:";
  43.             foreach (string s in Sastojci)
  44.             {
  45.                 ret += s ;
  46.                 ret += " " ;
  47.             }
  48.             ret += "\n" ;
  49.             return ret ;
  50.         }
  51.     }
  52. }
  53.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement