public MerkServiceResponse GetAllMerk()
        {
            MerkServiceResponse response = new MerkServiceResponse();
            Collection<Merk> merks = _merkRepository.GetAll();

            if (merks.Count == 0)
            {
                response.Messages.Add(new Message("Tidak Ada Merk Yang Terdaftar"));
            }
            else
            {
                foreach (var m in merks)
                {
                    CreateParameter param = new CreateParameter(m.Id, m.Code, m.Name, m.Manufacture);
                    MerkDomain merk = MerkDomain.Create(param);
                    MergeExtension.Merge(merk, m);
                    response.MerkDomains.Add(merk);
                }
            }
            return response;
        }
        public MerkServiceResponse GetMerkById(string id)
        {
            MerkServiceResponse response = new MerkServiceResponse();

            Merk merk = _merkRepository.GetById(id);
            if (merk.Id == null)
            {
                response.Messages.Add(new Message("Data is not in Database"));
            }
            else
            {
                CreateParameter param = new CreateParameter(merk.Id, merk.Code, merk.Name, merk.Manufacture);
                response.MerkDomain = MerkDomain.Create(param);
            }
            return response;
        }
Beispiel #3
0
 private MerkDomain(CreateParameter param)
 {
     this.Id = new MerkId(param.OwnerId, param.Code);
     this.Name = param.Name;
     this.Manufacture = param.Manufacture;
 }
Beispiel #4
0
 public static MerkDomain Create(CreateParameter param)
 {
     return new MerkDomain(param);
 }