Пример #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;
        }
Пример #2
0
 private bool validateMandatoryField(MerkDomain merk)
 {
     return (merk.Id == null) || (string.IsNullOrWhiteSpace(merk.Name));
 }