Exemplo n.º 1
0
        public MerkServiceResponse Create(MerkDomain merk)
        {
            MerkServiceResponse response = new MerkServiceResponse();


            if (validateMandatoryField(merk))
            {
                response.Messages.Add(new Message("Mandatory fields is empty"));
            }
            else if (!validateIsNotExist(merk.Id.OwnerId))
            {
                #region TO DO Create Unit Test
                response.Messages.Add(new Message("Data is already on database"));
                #endregion
            }
            else
            {
                merkEntity = new Merk();
                MergeExtension.Merge(merkEntity, merk);
                _merkRepository.Add(merkEntity);
                _merkRepository.SaveChanges();
            }

            return(response);
        }
Exemplo n.º 2
0
        public void InsertTest()
        {
            //Add first
            _repository.Add(merkStub1);
            _repository.SaveChanges();

            //Check whether on database or not
            merk = _repository.GetById(merkStub1.Id);
            Assert.IsNotNull(merk, "Merk Berhasil Terbuat");

            //Delete so this method can be used again
            _repository.Delete(merkStub1);
            _repository.SaveChanges();
        }