public APIResponse AddNewPromotion(AddNewPromoInfo addNewPromoInfo) { APIResponse aPIResponse = new APIResponse(); try { string query = "dbo.usp_LaunchPromoBasedonProdCode"; foreach (string country in addNewPromoInfo.CountryCode) { using (SqlConnection con = new SqlConnection(this.settings.Value.GQNet)) { con.Open(); using (SqlCommand command = new SqlCommand(query, con)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@ProdCode", addNewPromoInfo.ProductCode); command.Parameters.AddWithValue("@PricePlanType", addNewPromoInfo.PricePlanType); command.Parameters.AddWithValue("@PricePlanID", addNewPromoInfo.PricePlanId); command.Parameters.AddWithValue("@StartDate", addNewPromoInfo.StartDate); command.Parameters.AddWithValue("@EndDate", addNewPromoInfo.EndDate); command.Parameters.AddWithValue("@OldEndDate", addNewPromoInfo.OldPromoDate); command.Parameters.AddWithValue("@Currency", addNewPromoInfo.Currency); command.Parameters.AddWithValue("@IRPrice", addNewPromoInfo.IRPromoPrice); command.Parameters.AddWithValue("@ReIRPrice", addNewPromoInfo.IRRegularPrice); command.Parameters.AddWithValue("@RetailPrice", addNewPromoInfo.RetailPromoPrice); command.Parameters.AddWithValue("@ReRetailPrice", addNewPromoInfo.RetailRegularPrice); command.Parameters.AddWithValue("@CUV", addNewPromoInfo.CUV); command.Parameters.AddWithValue("@CountryCode", country); command.Parameters.AddWithValue("@ShipFeeSH", addNewPromoInfo.ShipFee); command.Parameters.AddWithValue("@DSP", addNewPromoInfo.RSP); command.CommandType = CommandType.StoredProcedure; SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { aPIResponse.ErrorMessage = Convert.ToString(reader["Error"]); aPIResponse.IsSuccess = string.IsNullOrEmpty(aPIResponse.ErrorMessage) ? true : false; } } } } } catch (Exception ex) { aPIResponse.IsSuccess = false; aPIResponse.ErrorMessage = ex.Message; } return(aPIResponse); }
public APIResponse AddNewPromotion(AddNewPromoInfo addNewPromoInfo) { return(iPromoLaunchRepository.AddNewPromotion(addNewPromoInfo)); }
public ActionResult AddNewPromo([FromBody] AddNewPromoInfo addNewPromo) { return(Json(iPromoLaunchService.AddNewPromotion(addNewPromo))); }