コード例 #1
0
ファイル: TagServices.cs プロジェクト: al-main/CloudyBank
        public void CreateTag(int customerID, TagDto tagDto)
        {
            UserTag tag = new UserTag();
            tag.Name = tagDto.Title;
            tag.Description = tagDto.Description;

            Customer customer = _repository.Load<Customer>(customerID);
            if (customer != null)
            {
                customer.Tags.Add(tag);
            }

            using (TransactionScope scope = new TransactionScope())
            {
                _repository.Save<Tag>(tag);
                _repository.Update<Customer>(customer);
                scope.Complete();
            }
        }
コード例 #2
0
ファイル: ITagServices.cs プロジェクト: al-main/CloudyBank
 public void UpdateTag(TagDto tag, int customerID)
 {
     Contract.Requires<TagServicesException>(tag != null);
     Contract.Requires<TagServicesException>(tag.Title != null);
     Contract.Requires<TagServicesException>(tag.Description != null);
 }
コード例 #3
0
 public void UpdateTag(TagDto tag, int customerID)
 {
     TagServices.UpdateTag(tag, customerID);
 }
コード例 #4
0
ファイル: TagServices.cs プロジェクト: al-main/CloudyBank
        public void UpdateTag(TagDto tagDto, int customerID)
        {
            Tag tag = _repository.Get<Tag>(tagDto.Id);
            tag.Name = tagDto.Title;
            tag.Description = tagDto.Description;

            using (TransactionScope scope = new TransactionScope())
            {
                _repository.Update(tag);
                _repository.Flush();
                scope.Complete();
            }
        }
コード例 #5
0
 public void CreateTag(int customerID, TagDto tag)
 {
     TagServices.CreateTag(customerID, tag);
 }