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); }
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); }