Esempio n. 1
0
        public async Task <ICommandResult> Handle(Category_VariationTheme_Mapping_RemoveCommand message)
        {
            try
            {
                Category_VariationTheme_Mapping category_VariationTheme_Mapping = new Category_VariationTheme_Mapping();
                category_VariationTheme_Mapping.Remove(message);
                await _variationThemeService.RemoveToDb(category_VariationTheme_Mapping);

                ICommandResult result = new CommandResult()
                {
                    Message  = "",
                    ObjectId = category_VariationTheme_Mapping.Id,
                    Status   = CommandResult.StatusEnum.Sucess
                };
                return(result);
            }
            catch (Exception e)
            {
                e.Data["Param"] = message;
                ICommandResult result = new CommandResult()
                {
                    Message = e.Message,
                    Status  = CommandResult.StatusEnum.Fail
                };
                return(result);
            }
        }
 public async Task Remove(Category_VariationTheme_Mapping category_VariationTheme_Mapping)
 {
     await WithConnection(async (connection) =>
     {
         DynamicParameters parameters = new DynamicParameters();
         parameters.Add("@VariationThemeId", category_VariationTheme_Mapping.VariationTheme_Id, DbType.Int16);
         parameters.Add("@CategoryId", category_VariationTheme_Mapping.CategoryId, DbType.String);
         return(await connection.ExecuteAsync(ProcName.Category_VariationTheme_Mapping_Remove, parameters, commandType: CommandType.StoredProcedure));
     });
 }
        public async Task Add(Category_VariationTheme_Mapping category_VariationTheme_Mapping)
        {
            DataTable table = new DataTable();

            table.Columns.Add("VariationThemeId", typeof(int));
            table.Columns.Add("CategoryId", typeof(string));
            foreach (var item in category_VariationTheme_Mapping.VariationThemeId)
            {
                table.Rows.Add(item, category_VariationTheme_Mapping.CategoryId);
            }

            await WithConnection(async (connection) =>
            {
                DynamicParameters parameters = new DynamicParameters();
                parameters.Add("@DataMapping", table, DbType.Object);


                return(await connection.ExecuteAsync(ProcName.Category_VariationTheme_Mapping_Insert_List, parameters, commandType: CommandType.StoredProcedure));
            });
        }
Esempio n. 4
0
 public async Task AddToDb(Category_VariationTheme_Mapping category_VariationTheme_Mapping)
 {
     await _variationThemeRepository.Add(category_VariationTheme_Mapping);
 }
Esempio n. 5
0
 public async Task RemoveToDb(Category_VariationTheme_Mapping category_VariationTheme_Mapping)
 {
     await _variationThemeRepository.Remove(category_VariationTheme_Mapping);
 }