public int editPriceHistory(long productId, string date, float price) { try { DTO_PriceHistory dto_pricehistory = new DTO_PriceHistory(); dto_pricehistory.ProductId = productId; dto_pricehistory.Date = date; dto_pricehistory.Price = price; return(dal_pricehistory.editPriceHistory(dto_pricehistory) == true ? 200 : 400); } catch { return(400); } }
public bool editPriceHistory(DTO_PriceHistory dto_pricehistory) { try { openConnect(); SqlCommand cmd = new SqlCommand("stp_editPriceHistory", conn); //Tên store procedure cmd.CommandType = CommandType.StoredProcedure; //Cho biết đây là store procedure cmd.Parameters.AddWithValue("@masp", dto_pricehistory.ProductId); cmd.Parameters.AddWithValue("@ngay", dto_pricehistory.Date); cmd.Parameters.AddWithValue("@gia", dto_pricehistory.Price); cmd.ExecuteNonQuery(); closeConnect(); //Đóng kết nối return(true); } catch { closeConnect(); return(false); } }