Example #1
0
        public long Add(StateEditData data)
        {
            using (var scope = new TransactionScope())
            {
                var id = _executor.Query <long>("[dbo].[State_Add]",
                                                new
                {
                    data.Name,
                    data.Position,
                    IsSystem = false,
                });

                _executor.Execute("[dbo].[StateLocalization_Merge]",
                                  new
                {
                    Name = data.LocalizedName,
                    TwoLetterISOLanguageName = data.Language,
                    StateId = id
                });

                scope.Complete();

                return(id);
            }
        }
Example #2
0
        public void Update(long id, StateEditData data)
        {
            using (var scope = new TransactionScope())
            {
                _executor.Execute("[dbo].[State_Update]",
                                  new
                {
                    data.Name,
                    data.Position,
                    Id = id
                });

                _executor.Execute("[dbo].[StateLocalization_Merge]",
                                  new
                {
                    Name = data.LocalizedName,
                    TwoLetterISOLanguageName = data.Language,
                    StateId = id
                });

                scope.Complete();
            }
        }