Beispiel #1
0
        public async Task <IActionResult> AddToBasket(AddToBasketParam data)
        {
            /*
             * بسته بودن فروشگاه
             * بررسی فروش مثبت برای محصولات کلافی
             * بررسی اعتبار شماره همراه و رمز عبور و دریافت اطلاعات کاربر
             * بررسی غیر فعال بودن حساب کاربری
             * بررسی اطلاعات شهر و استان
             * بررسی وجود نماینده در آن شهر درصورتی که کاربر تخفیف ندارد و ارسال لیست نمایندگان
             * بررسی کد ملی
             * اضافه کردن محصول به سبد خرید
             */
            var result = await repository.AddToBasket(data);

            return(Ok(new { result }));
        }
Beispiel #2
0
        public async Task <string> AddToBasket(AddToBasketParam data)
        {
            string connectionString = configuration.GetConnectionString("Default");

            var commandText = "AddToBasket";
            var command     = new CommandDefinition(commandText, data, commandType: CommandType.StoredProcedure);

            string result = "";

            try
            {
                using SqlConnection connection = new SqlConnection(connectionString);
                result = await connection.QueryFirstAsync <string>(command);
            }
            catch (Exception ex)
            {
                logger.LogError(ex.GetExceptionMessage());
                result = ex.Message;
            }

            return(result);
        }