示例#1
0
        public MerkModel Save(MerkModel merk)
        {
            //  validasi
            var result = merk;

            result = TryValidate(merk);

            //  save
            var dummyMerk = _merkDal.GetData(merk.MerkID);

            if (dummyMerk == null)
            {
                _merkDal.Insert(result);
            }
            else
            {
                _merkDal.Update(result);
            }

            return(result);
        }
示例#2
0
        public void GetData_ValidData_NoEx()
        {
            using (var trans = TransHelper.NewScope())
            {
                //  arrange
                var expected = MerkDataFactory();
                _merkDal.Insert(expected);

                //  act
                var actual = _merkDal.GetData("A1");

                //  assert
                actual.Should().BeEquivalentTo(expected);
            }
        }